ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashley Williams <ashpub...@mac.com>
Subject Re: Java in JDK but ANT can't find it!
Date Sun, 17 May 2009 12:59:47 GMT
Hi David,

I never meant that you should modify the ant code.
Try launching your app with the fully qualified
path to the jdk java eg:

 > /path/to/jdk/bin/java MyTestApp

So in other words don't rely on your PATH environment variable. It  
could be
also that the bootclasspath has been overridden so that tools.jar has  
been
taken out. Are you on the mac, in which case you don't have tools.jar?

Try the same experiment by stealing the very last line in the ant  
launcher
script and hardcoding the values that you know you need to use. On my
installation of ant I would start with this line:

ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath  
\"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir= 
\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher  
$ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"

I say this again, the idea behind this is that you need to assume that  
your
environment variables and shell scripts can't be trusted and therefore
bipass them.

I mentioned this before, but remove any compiler fork option so that  
the task
is being executed in the same vm. Then if it behaves differently in a  
forked
vm, you know that the vm environment isn't being inherited properly and
that's where you need to look.

You could try removing all java installations from your machine and then
reinstalling just the jdk that you need. I know for example that windows
gets up to tricks such as adding a java.exe in the windows system  
directory
that is always first in the PATH that you have to remember to manually
delete.

Sorry you are having all these frustrating problems, good luck.


On 16 May 2009, at 20:25, David Nemer wrote:

> Just a remark, when I run the application and /opt/jdk1.6.0_06/lib/ 
> tools.jar
> to the classpath. It gives me a different error message:  "Compile  
> failed;
> see the compiler error output for details." there is no error msg  
> and it
> still says BUILD SUCCESSFUL
>
>
> --
> David Nemer
> Sent from Kaiserslautern, RP, Germany
>
> On Sat, May 16, 2009 at 9:11 PM, David Nemer <davidnemer@gmail.com>  
> wrote:
>
>> Hello Michael,
>>
>> here is my code on how I'm invoking Ant:
>>
>>            Project p = new Project();
>>            p.setUserProperty("ant.file",  
>> buildFile.getAbsolutePath());
>>            DefaultLogger consoleLogger = new DefaultLogger();
>>            consoleLogger.setErrorPrintStream(System.err);
>>            consoleLogger.setOutputPrintStream(System.out);
>>            consoleLogger.setMessageOutputLevel(Project.MSG_INFO);
>>            p.addBuildListener(consoleLogger);
>>            p.fireBuildStarted();
>>            p.init();
>>            ProjectHelper helper = ProjectHelper.getProjectHelper();
>>            p.addReference("ant.projectHelper", helper);
>>            helper.parse(p, buildFile);
>>            p.executeTarget(p.getDefaultTarget());
>>
>> Michael, I read somewhere that when you invoke ANT in java, it runs  
>> in the
>> same JVM, and forking the ANT process might solve it. Do you have  
>> any idea
>> how would I code this?? Make Ant ran in another JVM?
>>
>>
>> --
>> David Nemer
>> Sent from Kaiserslautern, RP, Germany
>>
>> On Sat, May 16, 2009 at 9:03 PM, Michael Ludwig <milu71@gmx.de>  
>> wrote:
>>
>>> David Nemer schrieb am 16.05.2009 um 20:51:31 (+0200):
>>>
>>>> nemer@kubrick:~$ java -jar
>>> /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar
>>>> -version
>>>> Apache Ant version 1.7.1 compiled on June 27 2008
>>>>
>>>> nemer@kubrick:~$ /opt/jdk1.6.0_06/bin/java -jar
>>>> /home/nemer/apache-ant-1.7.1/lib/ant-launcher.jar -version
>>>> Apache Ant version 1.7.1 compiled on June 27 2008
>>>>
>>>> so just running JAVA worked as well as running /opt/jdk1.6.0_06/ 
>>>> bin/java
>>>
>>> So tools.jar is found alright. It's an environmental problem,  
>>> either in
>>> the ant shell script (has that been tampered with?) or, more  
>>> likely, the
>>> shell script you're using to launch it.
>>>
>>> Michael Ludwig
>>>
>>> ---------------------------------------------------------------------
>>> 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


Mime
View raw message