Wednesday, September 22, 2010

How to compile a set of .java files from a bulk of .java files at a time ?

Posted by Sharath Chandra
Sometimes we have to compile the set of .java files from a bulk .java files... at that time we will go for manually compiling each and every file and have to compile through the command line.

Here is the simplest method to do that ...

If we are having a 20 of .java files in a directory/folder. But we need only 8 of them to be compile.

So instead of compiling those 8 .java files manually... just paste all the 8 .java filenames into a text file and save this text file with "anyname.txt"

Now just go to command line and run this command from the directory where you placed all the .java files.

/javac @anyname.txt


It creates the .class files of 8 .java files which we were mentioned in the "anyname.txt" file.