ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin J Citron <kev...@elp.rr.com>
Subject Re: Ant ClassLoader Woes
Date Tue, 18 Nov 2003 14:52:17 GMT
Thanks for the reply.
My JAVA_HOME does correctly point to the JDK which is located at
at /usr/j2sdk1.4.2_02

The tools.jar is appropriately located in $JAVA_HOME/lib/tools.jar
I wrote a small shell script that sets the classpath to 
$JAVA_HOME/lib/tools.jar which runs a Java program which does a

#!/bin/sh
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
echo $CLASSPATH
java -cp $CLASSPATH ClassLoaderTest


try {
            Class.forName("com.sun.tools.javac.Main");
            System.out.println("I found the tools.jar");
        }
       
        catch(ClassNotFoundException e){
          System.out.println("" + e);   
        }

It runs fine.  This JDK comes from Sun.
I am using the ant wrapper. The classpath is getting set correctly 
because I place an echo $LOCALCLASSPATH
in the ant wrapper so I can see it. If the CLASSPATH was not getting set 
correctly. The JVM would fail to find the ant Main class. I appreciate 
the help. But, I'm fairly certain that the ClassLoader used by the 
org.apache.tools.ant.Main has a diffent
classpath than the one on the ant wrapper command line.

Thanks again.


Stefan Bodewig wrote:

>On Mon, 17 Nov 2003, Kevin J. Citron <kevinc@elp.rr.com> wrote:
>
>  
>
>>Unable to find a javac compiler; com.sun.tools.javac.Main is not on
>>the classpath.
>>    
>>
>
>This means that for some reason your JDK's tools.jar has not been
>included in the CLASSPATH.
>
>If you point your JAVA_HOME environment variable to your JDK
>installation (and export JAVA_HOME, of course), Ant's wrapper script
>is supposed to include it automatically.
>
>  
>
>>Detected Java version: 1.4 in: /usr/j2sdk1.4.2_02/jre
>>    
>>
>
>This means, that JAVA_HOME should point to /usr/j2sdk1.4.2_02 and that
>the the "ant" wrapper script should include
>/usr/j2sdk1.4.2_02/lib/tools.jar in the CLASSPATH.
>
>There are a couple of reasons why this could fail:
>
>* There is no /usr/j2sdk1.4.2_02/lib/tools.jar - which JDK is this,
>  where did you get it from?
>
>* you are not using Ant's wrapper script at all - how do you invoke
>  Ant?
>
>* you use a modified version of the wrapper script - where did you get
>  your version of Ant?
>
>Probably more reasons are possible.
>
>Stefan
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>
>  
>

-- 

Kevin J Citron
Sr. Object Imagineer
Optimized Objects, Inc.
EL Paso, Texas 79930
(915) 565-7785/566-2403


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