newbie compile question

N

Nandan

I have a set of .java files in a directory hierarchy (organized according to
their respective packages) under src.

How can I use the java command line compiler to compile all the relevant
files? I know of the

javac -d bin *.java
trick that populates a bin directory in a package-appropriate way.
after that I can simply run jar cf bin with some extra options.

Is there some way to make the java compiler recursively compile all
the .java files belonging to the src dir's package hierarchy?

Thanks a lot,
N
 
F

Fahd Shariff

You can use something ugly like: javac */*/.../*.java

Or use command substitution from the root source directory: javac
`find . -name *.java`

But my favourite is ant. If you dont know it, learn it. Its a great
skill to have.
 
T

Thomas Weidenfeller

Nandan said:
Is there some way to make the java compiler recursively compile all
the .java files belonging to the src dir's package hierarchy?

Usually people use what is called a "build system" for such tasks,
because all the typing gets boring after some time.

Either they use the build-in build system ("project management") of some
IDE, or some external build tool. Common external build tools are make
(the generic make versions have some problems with the way javac works),
or ant (specifically made for Java, but with an absolutely brain-dead,
XML-based file format).

BTW: You might want to post beginner's questions to comp.lang.java.help
in the future, and specific questions regarding tools to
comp.lang.java.softwaretools

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top