This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm wondering about how to use javac command options in the windows command line. I've looked up several tutorials, including Oracle's. I want to be able to create a batch file that finds the source code in one folder and places the compiled classes in another.
The javac documentation contains a section that describes exatcly this in some detail. Have a look at the examples posted there, especially the one under heading 'Separating Source Files and Class Files'. It's hard to give any useful suggestions specific to your situation without knowing more about the error message and the directory sctructure.
On a related note, you said you're looking to script the javac call in a batch (.bat) file. I suggest you have a look at Apache ANT instead.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Joined: Nov 05, 2010
My instructor is offering bonus marks if we "Deliver your project so it can be built with ant". I can't believe I hadn't even though of using an ANT script; I'll definitely look into that.
In the meantime, why won't my batch file work?
I'm in the current directory, which contains:
Beans is the package name. The package beans under the src directory, contains my .java files. The package beans under classes is empty. I want to compile those .java files (in src\beans) and put all the .class files in the "classes\beans" package.