View Single Post
Old 02-13-2007, 01:44 PM   #1 (permalink)
Vormund
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Question Batch file...command output...ideas?

I'm trying to make a simple batch file for compiling Java files via the command line, for the time being to do this:

1. Run the batch.
myBatchFile.bat MyClass

2. Compile the file.
javac %1.java

3. Determine if an error was spewed by Java, if so, abort, otherwise continue.
This is where the problem is - how to determine if Java spewed an error.

I was thinking along the lines of running the compile command with the > file.txt, and determining if file.txt had content, if so, there was an error...but that doesn't work, it only creates an empty file (which I don't fully understand as of yet).

As well, I still want the error displayed on the screen, so even if it did work, I want the error displayed as well.

4. Run the class
java %1


The bottom line, does anyone have any idea how to do #3? If you need clarification, let me know...

TIA!
Vormund
__________________
Vormund is offline