ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "THUFIR HAWAT" <thufir.ha...@mail.com>
Subject javac and java -classpath with regards to ant
Date Fri, 04 Feb 2005 10:27:06 GMT
I'm think out loud about ant; I want build.xml to do:

<javac
	srcdir		="${sourcedir}"
	destdir		="${destdir}"
	classpath	="${classpath}"
	includes	="${includes}"
/>

inspired by
<http://developers.sun.com/dev/coolstuff/javamake/ant.html>

because that seems to spell out exactly what's sent to
javac.  the properties:

property	value
--------	-----
sourcedir	/java/sources/atreides/jtidy/
destdir		/java/classes/
classpath	/java/sources/org/w3c/tidy/Tidy.jar
includes	/java/sources/org/w3c/tidy/Tidy.jar

Now,

"The class path tells the JDK tools and applications
where to find third-party and user-defined classes --
that is, classes that are not extensions or part of the
Java platform. The class path needs to find any classes
you've compiled with the javac compiler -- its default
is the current directory to conveniently enable those
classes to be found,"
<http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html>

so, TidyTest.java is in "sourcedir" and imports
org.w3c.tidy.Tidy using Tidy.jar, so the path to
Tidy.jar would be in the classpath.  TidyTest.jar is in
the sourcedir, so doesn't need to be in the classpath.

I'm looking at this snippet, too:

<classpath path="${classpath}"/>
<http://ant.apache.org/manual/using.html#path>

But, don't know what it does, really, but since it
involves classpath it might be useful.

when using "plain" javac from the command line, it's
enough to use the "classfile" switch and give the path to
Tidy.jar like so:

/////////command line///////////////
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>javac @comp

C:\>java -classpath
.;C:\java\classes\org\w3c\tidy\Tidy.jar;C:\java\classes\
atreides.jtidy.Tid
yTest

C:\>type comp
-d C:\java\classes\
-g
-sourcepath C:\java\sources\
-classpath
.;C:\java\classes\;C:\java\classes\org\w3c\tidy\Tidy.jar
C:\java\sources\atreides\jtidy\TidyTest.java


And that's what I want ant to do, but I don't quite know
how to put it all together.  Do I include classpath info
in the manifest for the jar which'll be built so that the
jar is clickable?  The Main-Class should read
"atreides.jtidy.TidyTest" indicating where the main class
is, of course.

Since it's necesarry to include the classpath for
package org.w3c.tidy.Tidy to run TidyTest.class it
follows that Tidy.jar and its classpath must also be
included, down the road, in TidyTest.jar.

I hope I'm making at least some sense.  For right now
I'll concentrate on getting ant to compile TidyTest.java
so that TidyTest.java can be executed with the java command,
then I'll work on packaging it up.  Does that seem a good
way to approach this topic?


Thanks,

Thufir Hawat




-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message