aspose file tools*
The moose likes Java in General and the fly likes javac command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "javac command " Watch "javac command " New topic
Author

javac command

Daniela Ch
Ranch Hand

Joined: Dec 13, 2002
Posts: 96
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

Joined: Dec 05, 2002
Posts: 65
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

Joined: Dec 13, 2002
Posts: 96
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

Joined: Sep 29, 2000
Posts: 8521
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.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Phil Lesh
Greenhorn

Joined: Oct 16, 2002
Posts: 17
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

Joined: Oct 12, 2001
Posts: 1179

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 ]

Regards, Rene Larsen
Dropbox Invite
Daniela Ch
Ranch Hand

Joined: Dec 13, 2002
Posts: 96
thank you all...
I feel supported
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javac command
 
Similar Threads
packages
Interfaces
Simple Ant Build
Why am I getting these weird package errors?
Unable to import a my package.