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