Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > newbie compile question

Reply
Thread Tools

newbie compile question

 
 
Nandan
Guest
Posts: n/a
 
      11-04-2004
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
 
Reply With Quote
 
 
 
 
Fahd Shariff
Guest
Posts: n/a
 
      11-04-2004
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.

--
Fahd Shariff
http://www.fahdshariff.cjb.net
"Let the code do the talking..."
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      11-04-2004
On Thu, 04 Nov 2004 11:01:07 -0500, Nandan wrote:

> Sub: newbie ... question


...best dealt with on a group described here..
<http://www.physci.org/codes/javafaq.jsp#cljh>

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      11-05-2004
Nandan wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile directive for conditional compile for Java 1.4 versus Java 5 timjowers Java 7 02-02-2011 12:08 AM
How to compile the following source code in VC6// I have error inVC++6 but compile ok in GCC fAnSKyer C++ 2 06-07-2009 07:57 AM
computation at compile time i.e. compile time functions usingtemplates Carter C++ 2 03-04-2009 06:43 PM
Compile versus not compile (VS 2005)?? stupid48@gmail.com ASP .Net 1 04-11-2008 08:24 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM



Advertisments