File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Using Javac Command Line Options in Windows 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 » Java in General
Bookmark "Using Javac Command Line Options in Windows" Watch "Using Javac Command Line Options in Windows" New topic
Author

Using Javac Command Line Options in Windows

Lindsay Fester
Greenhorn

Joined: Nov 05, 2010
Posts: 9
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.

What I can enter without a usage error:



What I try to enter, but get a usage error:



Can anyone shed some light on this issue?
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1753
    
    7

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.
Lindsay Fester
Greenhorn

Joined: Nov 05, 2010
Posts: 9
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:

"src\beans"
"classes\beans"

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.

Thanks for the input so far!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Javac Command Line Options in Windows
 
Similar Threads
Classpath in Command line
Reading Chapter 10 to Grasp Chapter 1 public, protected, private mechanisms
Error while compling
compiling error
getting started