Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javac command

 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to know the javac arguments to compile all the java files in subdirectories...
the only way I know is when I go as deep in my directory structure and type :
javac -d c:\project *.java
Is there a way to compile all the java files in all the subdirectories of c:\project?
thanks again
/Daniela
ps: Cindy I have allready posted this thread in begginer but nobody answered
 
Chris De Vries
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a project starts having several subdirectories, I would suggest using ant to help automate the build process. Ant can compile java code in multiple subdirectories and recreate that same directory structure in the destination directory. It also has many other useful features, and is written in java so it runs on windows, linux, solaris, etc...
I hope that helps you. If you need any more help don't hesitate to ask.
Chris
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you Chris,
I am doing my Java Developer certification and I have to provide the javac command line to SUN for them to compile my application...
they probably know it huhu but they asked for it in the assignement...this is why I need to have it...
Do you have any clue?
daniela
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would create a file (named argfile or whatever) to list the directories to be compiled and then use:
C:> javac @argfile
Javac Instructions.
This suggests also putting your options in a file and referencing that at the command line.
 
Phil Lesh
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote this in a make.bat file for windows and it works fine for the following structure:
App
|_data
|_gui
|_helper
TheApp.java - main file
Type make in the directory above App. Hope this helped.
Phil
--- code ---
@ECHO OFF
ECHO compiling...
javac App/data/*.java
javac App/gui/*.java
javac App/helper/*.java
javac App/*.java
ECHO done!
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniela Ch:
thank you Chris,
I am doing my Java Developer certification and I have to provide the javac command line to SUN for them to compile my application...
they probably know it huhu but they asked for it in the assignement...this is why I need to have it...
Do you have any clue?
daniela

You don't have to tell SUN who to compile your assignment - but you shall tell them who to run your program e.g. 'java -jar client.jar'
But one easy way to compile is to use ANT.
e.g.
<javac srcdir="src" destdir="classes" />
This sample compiles all *.java in the 'src' dir.
Rene
[ December 31, 2002: Message edited by: Rene Larsen ]
 
Daniela Ch
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you all...
I feel supported
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic