ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Kelly" <ke...@ad1440.net>
Subject ExecuteJava creates incorrect AntClassLoader
Date Sat, 27 Jan 2001 02:12:04 GMT
I'm seeing a problem with <java> execution.

Here's the deal: I'm trying to run a Java program called
BuildDependency, a thing from Dallas Semiconductor that
acts as a linker/converter for Java programs before they
can be run on a TINI, a Java virtual machine on a SIMM.

BuildDependency takes a list of .class and .jar files,
loads them with its own class loader, operates on their
constant pools, checkes references, and otherwise
converts the whole thing into a file you can transfer to
a TINI and run.  BuildDependency comes in a file called
tini.jar, filled with various other TINI utilities.

When I run BuildDependency from Ant via <java>, and
tini.jar isn't in my CLASSPATH, and I use the classpath
attribute to point to tini.jar, it works.

If I remove the classpath attribute and put tini.jar in
my CLASSPATH, it works.

But if I have the classpath attribute *and* tini.jar in
my CLASSPATH, it doesn't work, failing with:

/home/saffron/kelly/junk/therm/build.xml:45: java.lang.IllegalAccessError:
try to access class WatchDog from class BuildDependency
java.lang.IllegalAccessError: try to access class WatchDog from class
BuildDependency
        at BuildDependency.replaceVariables(BuildDependency.java)
        at BuildDependency.getDependencies(BuildDependency.java)
        at BuildDependency.main(BuildDependency.java)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:107)
        at org.apache.tools.ant.taskdefs.Java.run(Java.java:245)
        at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:122)
        at org.apache.tools.ant.taskdefs.Java.execute(Java.java:86)
...

Now, if I modify the way ExecuteJava gets the
AntClassLoader, I can get it to work, by changing:

    AntClassLoader loader = new AntClassLoader(project, classpath);

to:

    AntClassLoader loader = new AntClassLoader(project, classpath,
/*systemFirst*/false);

Question is, why isn't this the case in the Ant source?
If the user's specified a classpath attribute in his
<java> task, should that be used preferentially
(systemFirst=false) to the system CLASSPATH?

--k



Mime
View raw message