ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jay Glanville" <dic...@nortelnetworks.com>
Subject Having a problem with the classpath passed to <javac> task
Date Mon, 04 Dec 2000 14:27:05 GMT
I am trying to compile my source code to a target 1.1 VM.  The compilers I
like to use are Jikes and javac 1.3.  My problem is that when I use the
<javac> task in conjunction with a 1.3 runtime environment, the tools.jar
file gets included in the classpath if I'm using the modern compiler, and
tools.jar and rt.jar if I'm using the jikes compiler.  This is the major
reason that I cannot use Ant in my build environment.

As you can see by my included build.xml below, I'm using the bootclasspath,
extdirs and target attributes required by the compilers to ensure that my
code gets compiled against the 1.1 libraries.  However, as you can see from
the output of Ant (I've included output from both the modern compiler and
the jikes compiler) that tools.jar gets included in my classpath.

Why is this a big concern for me?  What happens if one of the designers
accidentally uses a Collection object in their sourcecode?  the loadbuild
would go through without any problems.  However, when the client was running
that class on their 1.1 virtual machine, a "class not found exception" would
be thrown when the JRE came across the Collection object.

Is there anything I can do to solve this problem (excluding having to use a
<exec> task) ?

While I'm on the subject of unwanted stuff in the classpath, is there any
way that I can get rid of the ant libraries?  I know that there is very
little chance of namespace collisions, or any other worries.  But it would
be nice to simply have the following as an execution line: jikes -d
F:\test\classes -classpath
C:\jdk\1.1.8\lib\classes.zip;F:\test\classes;F:\test\src



Thanks,
Jay

PS:  How to I set the value of extdirs to be ""?




The following is the output of an "ant -verbose" command where
build.compiler=jikes:
--->8--------------------------------------------------------------
F:\test>ant -verbose
Ant version 1.2alpha3 compiled on October 11 2000

Searching for build.xml ...
Searching in F:\test
Buildfile: F:\test\build.xml
Detected Java Version: 1.3
Detected OS: Windows NT
Project base dir set to: F:\test
Build sequence for target `default_target' is [default_target]
Complete build sequence is [default_target]
    [javac] Compiling 3 source files to F:\test\classes
    [javac] Using jikes compiler
    [javac] Compilation args: jikes -d F:\test\classes -classpath
C:\jdk\1.1.8\lib\classes.zip;F:\test\classes;F:\bin\jakarta-ant\lib\jaxp.jar
;F:\bin\jakarta-ant\lib\parser.jar;F:\bin\jakarta-ant\lib\ant.jar;F:\bin\jak
arta-ant\lib\loadbuild.jar;C:\jdk\1.3.0\lib\tools.jar;C:\jdk\1.3.0\jre\lib\r
t.jar;F:\test\src
    [javac] Files to be compiled:
    F:\test\src\A.java
    F:\test\src\B.java
    F:\test\src\C.java


BUILD SUCCESSFUL

Total time: 4 seconds
--->8--------------------------------------------------------------







The following is the output of an "ant -verbose" command where
build.compiler=modern:
--->8--------------------------------------------------------------
F:\test>ant -verbose
Ant version 1.2alpha3 compiled on October 11 2000

Searching for build.xml ...
Searching in F:\test
Buildfile: F:\test\build.xml
Detected Java Version: 1.3
Detected OS: Windows NT
Project base dir set to: F:\test
Build sequence for target `default_target' is [default_target]
Complete build sequence is [default_target]
    [javac] Compiling 3 source files to F:\test\classes
    [javac] Using modern compiler
    [javac] Compilation args: -d F:\test\classes -classpath
F:\test\classes;F:\bin\jakarta-ant\lib\jaxp.jar;F:\bin\jakarta-ant\lib\parse
r.jar;F:\bin\jakarta-ant\lib\ant.jar;F:\bin\jakarta-ant\lib\loadbuild.jar;C:
\jdk\1.3.0\lib\tools.jar -sourcepath F:\test\src -target 1.1 -bootclasspath
C:\jdk\1.1.8\lib\classes.zip -extdirs
    [javac] Files to be compiled:
    F:\test\src\A.java
    F:\test\src\B.java
    F:\test\src\C.java


BUILD SUCCESSFUL

Total time: 1 second
--->8--------------------------------------------------------------


The following is my sample build.xml
--->8--------------------------------------------------------------
<project name="TestProject" default="default_target" basedir="." >
  <property name="build.compiler" value="modern" />
  <target name="default_target" >
    <javac srcdir="src" 
        destdir="classes" 
        includes="**/*.java"
        classpath=""
        bootclasspath="c:/jdk/1.1.8/lib/classes.zip"
        extdirs=""
        target="1.1" />
  </target>
</project>
--->8--------------------------------------------------------------


----------------------------------------------------------------------------
-----
Jay Dickon Glanville
P068 - SiteManager Development, Nortel Networks
613-765-1144 (ESN 395-1144)
MS: 045/55/A05
E-Mail: dickon@nortelnetworks.com


Mime
View raw message