Click to See Complete Forum and Search --> : compiling


wang shao
September 26th, 2000, 09:05 AM
Hi,
If I've a lot of package like com.a.b.*; com.a.b.c*; com.a.d.*;........ and a lot of classes with imort packages like import com.a.b.*; import com.a.d.*;...please give me some ideas how to compile them. I try like:
javac -classpath directory(which holds com.a......) *.java , but this seems not work. Thanks in advance.
wang

kannanbalu
September 26th, 2000, 02:39 PM
Hi ,
I think in such a case it will be better if you create a makefile, so
that you need not follow all the steps of compiling again and again.

Kannan

Phill
September 27th, 2000, 03:09 AM
Hi
The easiest way i know how to do this is
to make a .txt file with the names of the classes,
The contents would be similar to this:

YourFile.java
AnotherFile.java
AndYetAnother.java

Save this file in the directory where
all of your java files are, and then
make your dos working directory in the same
directory and then just type

javac -d . @YourTxtFile.txt


Dont forget the dot after -d
This will compile and package all the
files listed in your text file, unless
they have errors.

Good luck Phill.

wang shao
September 27th, 2000, 08:53 AM
Hi,
How can I make a jar file with only classes?
When I try this like: jar myjar.jar *.class, it seems that my jar file contains
all java source files, how can just jar class file? Thanks in advance.
wang

Phill
September 28th, 2000, 04:45 AM
Hi
You can do it by specifying which files
you want in the jar file ie:

jar cmf MANIFEST.MF YourJar.jar YourClass.class AnotherClass.class

you can add a lot of classes this way or alternatively write all the names of the file
in a text file and then go

jar cmf MANIFEST.MF YourJar.jar @YourFileNames.txt

good luck
Phill.