*
The moose likes Beginning Java and the fly likes how to compile all java source code in command line? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to compile all java source code in command line?" Watch "how to compile all java source code in command line?" New topic
Author

how to compile all java source code in command line?

Nancy Zhang
Greenhorn

Joined: Jan 07, 2005
Posts: 25
I've unzipped JDK source code src.zip to .\jdk\src\, but how to compile them in dos command and generate class files in a specified dir, say .\test\?
Thanks.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Well, under plain old CMD.EXE it'd be hard, as there's no way that I know of to specify "all the *.java files" at the command line. If you've got Cygwin, or can do this on a UNIX system instead, then "find" is your friend:

% cd src
% javac -d ./test `find . -name '*.java'`

Now, I'm sure that won't complete without errors: there are likely dependencies on other code for which the source isn't provided. So you may need to use the -classpath switch to include one or more of the JAR files included in the JDK distribution.
[ February 21, 2005: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to compile all java source code in command line?
 
Similar Threads
How can I build a console application in Eclipse when Eclipse doesn't support it properly? (afaik)
compiling error
Is there a way to compile all JDK source?
JBuilder 9 with JDK1.5.0 beta
Compile and execute java with java