ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nemer <davidne...@gmail.com>
Subject Re: Java in JDK but ANT can't find it!
Date Sat, 16 May 2009 14:11:30 GMT
Hello Martin,

The vars are all set up right. And it is "not" an ANT problem. The problem
is that the "java.home" points to JAVA_HOME/jre , if I ever call this method
"System.getProperty("java.home");" it will return to me JAVA_HOME/jre
(/opt/jdk1.6.0_06/jre in my case). And all we want is the pure JAVA_HOME (no
/jre).

So I found this interesting post that explains better:

"println ( System.properties.'java.home' );

prints the path to the JRE for me as well. This is of course not surprising
and exactly as it should be since this is the path to the JVM, not to the
JDK.

I think it is clear that the Ant error message is completely misleading. I
have added a bug report in the Ant Bugzilla (43794).

I think we have to find out what Ant does internally to allow the javac task
to run, so that we know how Ant gets round this problem."



--
David Nemer
Sent from Kaiserslautern, RP, Germany

On Sat, May 16, 2009 at 3:50 PM, Martin Gainty <mgainty@hotmail.com> wrote:

>
> Herr Nemer
>
> you would'nt be able to run ANT if your JAVA environment vars was fouled up
> JRE_HOME points to JRE folder (which contains only java.exe)
> JDK_HOME points to location of BASE FOLDER of javac.exe
> PATH=%JDK_HOME%/bin
>
> Mit Freundliche Gruben
> Martin
> GMT+5
> das Amerika
> ______________________________________________
> Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
> Vertraulichkeitanmerkung/Note de déni et de confidentialité
>  Ez az
> üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
> jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
> készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
> semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
> könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
> ezen üzenet tartalma miatt.
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
> destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
>
>
>
>
> > Date: Sat, 16 May 2009 15:36:19 +0200
> > Subject: Re: Java in JDK but ANT can't find it!
> > From: davidnemer@gmail.com
> > To: user@ant.apache.org
> >
> > Hello Supareno,
> >
> > I running it using the command line (running in a linux-server ). And ant
> is
> > also running properly.
> >
> > Cheers,
> > --
> > David Nemer
> >
> >
> > On Sat, May 16, 2009 at 12:51 PM, supareno <reno.rkcrew@free.fr> wrote:
> >
> > > David ,
> > >
> > > are you using an IDE to run this simple code or are you using the
> command
> > > line?
> > > is the 'ant' command line tool is working properly in a terminal?
> > >
> > > supareno
> > >
> > >
> > >  Hey all,
> > >>
> > >> Well, I did some testing, and I tried to run this simples Java code:
> > >>
> > >>    public static void main(String args[]){
> > >>
> > >>         String JAVA_HOME = System.getProperty("java.home");
> > >>         System.out.println(JAVA_HOME);
> > >>
> > >>    }
> > >>
> > >> And it prints out: /opt/jdk1.6.0_06/jre
> > >>
> > >> So, as Ashley said before, it is not an Ant's problem, it is an
> > >> environment
> > >> or Java problem.
> > >>
> > >> But, I checked, both, bash_profile and bashrc, and they all point to
> > >> /opt/jdk1.6.0_06, no JRE at all. So I was wondering where else could I
> > >> look
> > >> at so I can find where this JRE is set.
> > >>
> > >> Does anyone know where the method System.getProperty goes to get the
> > >> java.home? Like a file or something like that??
> > >>
> > >> Cheers
> > >>
> > >> PS: I also used that code to call and in my java code.
> > >>
> > >> --
> > >> David Nemer
> > >> Sent from Kaiserslautern, RP, Germany
> > >>
> > >> On Thu, May 14, 2009 at 5:36 PM, Ashley Williams <ashpublic@mac.com>
> > >> wrote:
> > >>
> > >>
> > >>
> > >>> I did a lot of copying and pasting from this website to get my own
> code
> > >>> up
> > >>> and running:
> > >>>
> > >>>
> > >>>
> > >>>
> http://www.ibm.com/developerworks/websphere/library/techarticles/0502_gawor/0502_gawor.html
> > >>>
> > >>> However I still believe the problem is with your environment rather
> than
> > >>> your code.
> > >>> Try editing the ant batch file or shell script in order to print out
> > >>> JAVA_HOME and PATH and
> > >>> just at the point where it runs org.apache.tools.ant.launch.Launcher.
> > >>>
> > >>> Then print out all environment variables at the top of your build.xml
> > >>> file.
> > >>> And print out
> > >>> java.home at the start of your java application.
> > >>>
> > >>> If you are forking the compiler, could it not be inheriting the
> > >>> environment
> > >>> correctly?
> > >>>
> > >>>
> > >>> On 14 May 2009, at 16:22, Cole, Derek E wrote:
> > >>>
> > >>>  Ashley,  can you post a snippet of how you set up the project you
> launch
> > >>>
> > >>>
> > >>>> programmatically from java?
> > >>>>
> > >>>> What does your build file that you are running from java contain
in
> it?
> > >>>>
> > >>>> -----Original Message-----
> > >>>> From: Ashley Williams [mailto:ashpublic@mac.com]
> > >>>> Sent: Thursday, May 14, 2009 10:54 AM
> > >>>> To: Ant Users List
> > >>>> Subject: Re: Java in JDK but ANT can't find it!
> > >>>>
> > >>>> Check your PATH to make sure you are launching your application
from
> > >>>> the jdk and not the jre.
> > >>>>
> > >>>> I launch programatically and I don't get these errors with the
same
> > >>>> version of ant so it does
> > >>>> sound as if the problem lies outside of ant.
> > >>>>
> > >>>> On 14 May 2009, at 15:46, David Nemer wrote:
> > >>>>
> > >>>>  This is what I'm trying to tell you! My JAVA_HOME it is set as
> > >>>>
> > >>>>
> > >>>>> /opt/jdk1.6.0_06 I've triple checked it on my bash file! I
also
> > >>>>> check with
> > >>>>> echo $JAVA_HOME and which java, they all tell the right path,
but
> > >>>>> not ANT!
> > >>>>> This is why I don't understand where does ant get this /jre
!!
> > >>>>> --
> > >>>>> David Nemer
> > >>>>> Sent from Kaiserslautern, RP, Germany
> > >>>>>
> > >>>>> On Thu, May 14, 2009 at 4:42 PM, Ashley Williams <
> ashpublic@mac.com>
> > >>>>> wrote:
> > >>>>>
> > >>>>>  In your description you say that  JAVA_HOME=/opt/jdk1.6.0_06/jre
> > >>>>>
> > >>>>>
> > >>>>>> Seriously, try JAVA_HOME= /opt/jdk1.6.0_06 instead
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>> On 14 May 2009, at 15:28, Cole, Derek E wrote:
> > >>>>>>
> > >>>>>> When I had this problem, I KNOW that JAVA_HOME was set
correctly.
> I
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>> still ran into the problem. The OP here also said JAVA_HOME
was
> set
> > >>>>>>> correctly. There is some missing step here that prevents
the ant
> > >>>>>>> Project
> > >>>>>>> instance from knowing which Java to use.
> > >>>>>>>
> > >>>>>>> -----Original Message-----
> > >>>>>>> From: Ashley Williams [mailto:ashpublic@mac.com]
> > >>>>>>> Sent: Thursday, May 14, 2009 9:56 AM
> > >>>>>>> To: Ant Users List
> > >>>>>>> Subject: Re: Java in JDK but ANT can't find it!
> > >>>>>>>
> > >>>>>>> It looks like you are pointing to the jre not the jdk.
> > >>>>>>> Try repointing the JAVA_HOME environment variable to
the jdk
> > >>>>>>> directory
> > >>>>>>> instead,
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> On 14 May 2009, at 13:15, David Nemer wrote:
> > >>>>>>>
> > >>>>>>> Hello Everyone,
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>> I am running ANT programmatically in JAVA. So,
my task is to
> > >>>>>>>> build the
> > >>>>>>>> BUILD.XML.
> > >>>>>>>> I'm able to do so, but it throws an exception saying:
> > >>>>>>>>
> > >>>>>>>> /scratch2/nemer/test/xfire/build.xml:5: The following
error
> > >>>>>>>> occurred
> > >>>>>>>> while
> > >>>>>>>> executing this line:
> > >>>>>>>> /scratch2/nemer/test/xfire/build-common.xml:81:
Unable to find a
> > >>>>>>>> javac
> > >>>>>>>> compiler;
> > >>>>>>>> com.sun.tools.javac.Main is not on the classpath.
> > >>>>>>>> Perhaps JAVA_HOME does not point to the JDK.
> > >>>>>>>> It is currently set to "/opt/jdk1.6.0_06/jre"
> > >>>>>>>>
> > >>>>>>>> But in the end it says: BUILD SUCCESSFUL (but it
still throws
> that
> > >>>>>>>> exception).
> > >>>>>>>>
> > >>>>>>>> I already set all of my environment variables to
>  /opt/jdk1.6.0_06/
> > >>>>>>>> (JAVA_HOME and also in PATH), which is a JDK! And
even on the
> error
> > >>>>>>>> message
> > >>>>>>>> it says that the java is set to /opt/jdk1.6.0_06/jre
(which is a
> > >>>>>>>> JDK, I
> > >>>>>>>> don't know where it gets the jre from).
> > >>>>>>>>
> > >>>>>>>> So, does any one know how can I solve this problem?
Is there a
> > >>>>>>>> configuration
> > >>>>>>>> file in ANT that we need to set up! I'm stuck there!!
> > >>>>>>>>
> > >>>>>>>> I'm running the ant 1.7.1.
> > >>>>>>>>
> > >>>>>>>> Cheers,
> > >>>>>>>> --
> > >>>>>>>> David Nemer
> > >>>>>>>> Sent from Saarbrucken, SL, Germany
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>>
> > >>>>>>>
> > >>>>>>>
>  ---------------------------------------------------------------------
> > >>>>>>>
> > >>>>>>>
> > >>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > >>>>>
> > >>>>>
> > >>>>>> For additional commands, e-mail: user-help@ant.apache.org
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
>  ---------------------------------------------------------------------
> > >>>>>>>
> > >>>>>>>
> > >>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > >>>>>
> > >>>>>
> > >>>>>> For additional commands, e-mail: user-help@ant.apache.org
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>>
> > >>>>>>
> ---------------------------------------------------------------------
> > >>>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > >>>>>> For additional commands, e-mail: user-help@ant.apache.org
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>>
> > >>>>>
> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > >>>> For additional commands, e-mail: user-help@ant.apache.org
> > >>>>
> > >>>>
> > >>>>
> ---------------------------------------------------------------------
> > >>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > >>>> For additional commands, e-mail: user-help@ant.apache.org
> > >>>>
> > >>>>
> > >>>>
> > >>>>
> > >>> ---------------------------------------------------------------------
> > >>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > >>> For additional commands, e-mail: user-help@ant.apache.org
> > >>>
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> > >
>
> _________________________________________________________________
> Hotmail® goes with you.
>
> http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message