ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Lyon" <>
Subject RE: Compile question--Class not found
Date Thu, 02 Aug 2001 17:45:50 GMT

Thanks. One thing, there is a typo in my compile target example. From what I
understand you are trying to accomplish, you should compile package B first,
then compile package A. I had the order reversed in my example thanks to my
fat fingers (and fatter head).



-----Original Message-----
From: Michael Molloy []
Sent: Thursday, August 02, 2001 1:53 PM
To: ''
Subject: RE: Compile question--Class not found

I'll look at your suggestion. Ant is very new to me, so I'm not sure what
all of my options are.

Thanks for your thoughts.


-----Original Message-----
From: Matt Lyon []
Sent: Thursday, August 02, 2001 12:20 PM
Subject: RE: Compile question--Class not found


I'm not sure if I'm understanding your question correctly, but couldn't you
<javac/> Package B to a common directory, say "../Build/classes", <javac/>
Package A passing in a classpath pointer to "../Build/classes", then <jar/>
up the classes you need using the includes parameter? Something like:

<target name="init">
<property name="build.dir" value="..\..\Build"/>
<property name="build.classes.dir" value="${build.dir}\classes"/>
<property name="src" value="..\..\src"/>

<target name="compile"
          <!-- Establish \Build directory structure. -->
          <mkdir dir="${build.classes.dir}"/>

          <!-- Compile Package A classes. -->
          <javac srcdir="${src}"

                <!-- Compile Package B classes. -->
                <javac srcdir="${src}"

<target name="assemble"
           <!-- Assemble the jar module. -->
	<jar jarfile="${build.dir}\my.jar"


I'm not sure if that was what you were asking though...



-----Original Message-----
From: Michael Molloy []
Sent: Thursday, August 02, 2001 10:41 AM
To: ''
Subject: Compile question--Class not found

Just started using Ant, and I can already appreciate all the work that has
been put into it. Great tool.

However, I'm having a bit of a problem. I've got packageA and packageB.
packageA uses some classes in packageB. I tried the following using ant.

1. Compile packageB
2. Put the jar in ant/lib.
3. Compile packageA.
4. Move both jar files to my Windows 2000 development box.
5. Issued the java command: java -cp packageB.jar;packageA.jar MainClass

This worked some of the time, but most of the time I got a
ClassNotFoundException: packageB/SomeClass. The class is there, though.

The only way I could get this to work was to move the packageB source files
into the packageA directory and then call ant on packageA. The resulting
single jar file packageA.jar works fine everytime. The problem is that I use
packageB classes in other applications, so this is not an optimal solution.

Anyone have any suggestions? If it makes a difference, I'm compiling
everything on SuSE 7.1 with Sun JDK build 1.3.1-b24.

Thanks for any help.


View raw message