How to compile all files in directory to *.class files?
+3
A:
Well, this seems pretty obvious, so I may be missing something
javac *.java
(With appropriate library references etc.)
Or perhaps:
javac -d bin *.java
to javac create the right directory structure for the output.
Were you looking for something more sophisticated? If so, could you give more details (and also which platform you're on)?
Jon Skeet
2010-03-01 14:32:20
thank you, it works!
alex
2010-03-01 14:49:48
+1
A:
Here's a code fragment that I use to build an entire project where, as usual, source files are in a deeply nested hierarchy and there are many .jar files that must go into the classpath (requires UNIX utilities):
CLASSPATH=
for x in $(find | grep jar$); do CLASSPATH="$CLASSPATH:$x"; done
SRC=$(find | grep java$)
javac -cp "$CLASSPATH" $SRC
Kilian Foth
2010-03-01 14:39:19