• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compiling all files in all subdirecoty?

 
Sreedhar mar
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i want to compile all the files which are in different directorys like this

c:\java\
.\a
.\b
.\c

i want to compile all files in a,b,c directorys from c:\java at time (in a single command)


bye
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javac `find . -name '*.java'`

What? You're using Windows? Oh, sorry to hear that.

Most people use Ant these days for building Java applications. It's fairly easy to use and it solves this particular problem easily. Once you set up an Ant build file for your project, it will save you a lot of typing.
 
Jean-Francois Briere
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes ANT is the best build tool available for JAVA. I use it all the time!
I'm on Windows XP Pro and the cmd shell is, well, not allways useful (to say the least).
But if you want to do things like javac `find . -name '*.java'`, you can also install Cygwin and have fun!
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and unixutils are available without linux-emulator for windows too.

But if I understand correctly, your dirs are:


If they belong to the same project, a 'javac b\MainClass.java' should work, if your package-declarations are in order.


I read something about a switch to compile all files, found listed in a file.

Yes - I found it again:
$JAVA_HOME/docs/tooldocs/tools.html#basic

go to your sysarchitecture, and find:
javac @argfile
which means in the example above:


Since javac without arguments shows some options, it's surprising, that there are additional options, not shown.

Since sun normally is very calculable, this is super-surprising.

[ September 21, 2004: Message edited by: Stefan Wagner ]
[ September 21, 2004: Message edited by: Stefan Wagner ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic