ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Burton" <bi...@progress.com>
Subject Re: Stupid Windows question
Date Tue, 02 Jan 2001 19:01:41 GMT
Hello James,

You could try using what is known as "Download Extensions."  This allows
one jar file to reference jars elsewhere, normally using a relative
reference.

Rebuild MyAntTool.jar adding a manifest entry something like this:
  Class-Path: ant.jar jaxp.jar parser.jar optional.jar

Now, as long as MyAntTool.jar and all these jars listed in the Class-Path
directive are located in the same directory, MyAntTool.jar will be able to
find them as necessary.  For more information, see
http://java.sun.com/docs/books/tutorial/ext/basics/download.html.

However, there are other problems invoking Ant with the -jar option:
1. Ant needs the property ant.home set to the installation directory of
Ant.  Since you're using a 1.3 JVM this may not be a requirement but I'm
not sure.
2. Ant needs to be able to find the SDK's tools.jar.  This is normally
done by setting the JAVA_HOME variable to point to the JDK/SDK directory
before running ant.bat.

The following simple batch file sets a few environment variables for
convenience and then calls your GUI.  For instance:
  @echo off
  set JAVA_HOME=D:\jdk1.3
  set ANT_HOME=D:\jakarta-ant
  rem Run GUI which then invokes Ant
  %JAVA_HOME%\bin\java -Dant.home=%ANT_HOME% -cp %JAVA_HOME%\lib\tools.jar
-jar %ANT_HOME%\lib\MyAntTool.jar

The above assumes the appropriate jars in in the Class-Path manifest entry
as described above.  Otherwise, you will have to add them to the -cp
option.

You should also look at the bin\ant.bat script to see how it works.

-Bill Burton

James Bucanek wrote:
> 
> OK, I freely admit that Windows is not my primary platform, nor my
> platform of choice.
> 
> Never the less, I need to get Ant up and running and I'm running into
> a really stupid problem with Java on Windows.
> 
> I have a dedicated machine, that I just installed Win98 and JDK 1.3.
> Nothing else.
> 
> I have written a GUI wrapper around Ant and want to launch it to do
> builds.  But whenever I do, I get a NoClassDefFoundError:
> org/apache/tools/ant/BuildListener.
> 
> So, I assume that Java isn't finding the ant.jar classes.  If I put
> the ant.jar file in the same directory, and specify it on the command
> line (java -cp ant.jar -jar MyAntTool.jar) the program runs just fine.
> 
> But I want to put the ant.jar (and parser.jar, and jaxp.jar, and
> myTasks.jar) somewhere common.  I've read the notes on class paths on
> the java.sun.com site, and have tried (1) setting a CLASSPATH
> environment variable to point to the directory, (2) placing the jars
> in the \jdk1.3\jre\lib\ext, \jdk1.3\jre\lib, and \jdk1.3\lib
> directories, (3) specified those directories in the java command
> options, and (4) combinations of the above (restarting the entire OS
> between configuration changes, of course).
> 
> Nothing works, unless my application and jars are in the same
> directory and I explicitly specify all of the library jar on the
> command line.  Am I missing something?  This can't be that hard!
> 
> P.S. How can you redirect the stderr output from a command to a file?
> 
> Thanks in advance for any insight,
> 
> James
> 
> __________________________________
> James Bucanek
> <mailto:privatereply@gloaming.com>

Mime
View raw message