Is there a way to write compiler output to a file?
Thanks.
-Nick
Is there a way to write compiler output to a file?
Thanks.
-Nick
Not sure what you mean - normal compilation (javac) writes to a file - the output class file! 
If you want to see the bytecode generated for a class, use ‘javap’. Simply go to the directory with the ‘.class’ files in and type (for DOS):
javap -c myClass >bob.txt
This will create a file ‘bob.txt’ with the bytecode for the class.
If you want to see what is being used by the VM when running (the results of the JIT compiler) then the only way I know of is use a ‘proper’ C/C++ debugger (like Visual Studio) and use it to pause the app thats running to get at the assembly instructions. No debug info though 
…or do you mean “store the text that javac outputs to screen to a file”? In that case, you need to divert stdout and/or stderr (depending on what info you want to save).
…or are you calling javac from within a java program and attempting to capture stdout + stderr?
Whenever you compile something, you get some sort of output, whether it is errors, or successful compilation. I want to somehow capture that.
-Nick
[quote]Whenever you compile something, you get some sort of output, whether it is errors, or successful compilation. I want to somehow capture that.
-Nick
[/quote]
Well that’s the first thing I said.
Depends on your OS, but do a google for “redirecting stdout”. Usual syntax is approximately equal to:
javac [blah blah blah] > filename.txt