Eclipse compiler for Java.
Allows things like:
- running code in which a part of it does not compile, which may be useful while developing
- incremental build: building code as soon as you hit save on the IDE very quickly
GNU compiler for Java. Obsolete when JDK was made open source.
http://stackoverflow.com/questions/3032727/java-jre-vs-gcj
Compile HelloWorld.java source file into HelloWorld.class bytecode:
javac HelloWorld.java
Then run it with:
java HelloWorld
java -help
-source: specify the version of the source code input.
Can be the current version, or any major prior version.
Example:
javac -source 1.6 A.java
-target: specify the version of the targeted JVM.
TODO rt.jar vs other library class files? http://www.ibm.com/developerworks/library/j-5things11/ says: Then your custom implementation needs to be available to the bootstrap ClassLoader, which loads java.lang.Object and all his buddies.
Class files output directory.
Example:
javac -d bin A.java
generates bin/A.class.
Add full debug information to the class files.
By default, some debug information is already added, namely the line numbers and corresponding source code we see on exception traces.
But other things are not included, in particular local variable information that allows you to do locals on jdb.
All of them are prefixed by -X.
Only compile, or only interpret bytecode without compiling. No JIT.
Turn on/off compilation warnings.
Not possible to determine the correct bytecode: http://stackoverflow.com/questions/1537714/disabling-compile-time-dependency-checking-when-compiling-java-classes
Not sure if there is a convenient method for regular Java programs.
At least https://en.wikipedia.org/wiki/Android_Lollipop from 2014 seems to be doing that.