ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jeroen" <j_breedv...@hotmail.com>
Subject Re: Basic problem using ANT
Date Wed, 30 Aug 2000 08:00:10 GMT
Try including your classpath directly in the javac-task.

Like this:

<property name="classpath" value="${jar.dir}/dom2.jar:
                                      ${jar.dir}/parser.jar:
                                      ${jar.dir}/jaxp.jar:
                                      c:\java\lib\tools.jar"/>  <!-- note:
tools.jar -->

<target name="compile" depends="init">
  <javac srcdir="${src}" destdir="${classes}"/>
    <classpath>
      <pathelement path="${classpath}" />
      <pathelement location="lib/helper.jar" />  <!-- for example: jar only
needed for this particular target -->
    </classpath>
</target>

Or like this:

<target name="compile" depends="init">
  <javac srcdir="${src}" destdir="${classes}" classpath="${classpath}"/>
</target>

This way you don't have clutter your CLASSPATH with project specific class
files

What version of ant are running (ant -version)?

Jeroen




----- Original Message -----
From: "Howard Burgett" <HowardB@dataonair.com>
To: <ant-user@jakarta.apache.org>
Sent: Monday, August 28, 2000 7:38 PM
Subject: Basic problem using ANT


> Hi All!!
>
> I have just started using ANT and am having a problem getting it to
compile
> from a very basic build.xml.  My build.xml looks like:
>
> <project name="ref" default="compile" basedir=".">
>   <target name="init">
>     <tstamp/>
>     <property name="src" value="." />
>     <property name="classes"  value="." />
>   </target>
>
>   <target name="compile" depends="init">
>     <javac srcdir="${src}" destdir="${classes}"/>
>   </target>
>
> </project>
>
> I have a single file Test1.java to compile and ANT returns me the
following
> exception:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> sun/tools/javac/Main
>         at
org.apache.tools.ant.taskdefs.Javac.doClassicCompile(Javac.java,
> Compiled Code)
>         at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java,
Compiled
> Code)
>         at org.apache.tools.ant.Target.execute(Target.java, Compiled Code)
>         at org.apache.tools.ant.Project.runTarget(Project.java:681)
>         at org.apache.tools.ant.Project.executeTarget(Project.java,
Compiled
> Code)
>         at org.apache.tools.ant.Main.runBuild(Main.java, Compiled Code)
>         at org.apache.tools.ant.Main.main(Main.java, Compiled Code)
>
> The output from ant -verbose (only for the process portion if its
execution)
> is:
>
> Setting ro project property: ant.file -> C:\dev\ReferenceObjects\build.xml
> Setting project property: basedir -> C:\dev\ReferenceObjects
> Project base dir set to: C:\dev\ReferenceObjects
>  +Target: init
>    +Task: tstamp
> Setting project property: DSTAMP -> 20000828
> Setting project property: TSTAMP -> 1336
> Setting project property: TODAY -> August 28 2000
>    +Task: property
> Setting project property: src -> .
>    +Task: property
> Setting project property: classes -> .
>  +Target: compile
>    +Task: javac
> Build sequence for target `compile' is [init, compile]
> Complete build sequence is [init, compile]
> Executing Target: init
> Executing Target: compile
> Compiling 1 source files to C:\dev\ReferenceObjects
> Using classic compiler
> Compilation args: [-d, C:\dev\ReferenceObjects, -classpath,
> C:\dev\ReferenceObjects;C:\dev\ReferenceObjects;C:\j2sd
>
kee1.2.1\lib\j2ee.jar;C:\jakarta-ant\lib\ant.jar;C:\jakarta-ant\lib\parser.j
> ar;C:\jakarta-ant\lib\jaxp.jar;C:\jdk1.2.2\lib\tools.jar,
> -sourcepath, C:\dev\ReferenceObjects]
> Files to be compiled:
>     C:\dev\ReferenceObjects\Test1.java
>
> The class referred to in the exception (sun.tools.javac.Main) is clearly
in
> the tools.jar file, and the file is in the classpath above, so I am
stumped.
> What is this exception saying?  Have any of you seen similar problems?
>
> Howard Burgett
> Wireless ASP Division
> Brience, Inc.
> 407-492-6155
>
>
>
>
>
>

Mime
View raw message