What is the difference between using javac and javax.tools.JavaCompiler?

javac (as “java compiler”) is an executable, which could be theoretically even a platform-dependent executable or a script. This is called to compile a .java to a .class. On windows is its name javac.exe, and it is normally somewhere below C:\Program Files*\jdk*\bin. This compiler was developed in java as well. That means, if we start …

Read more

javac source and target options

source: The version that your source code requires to compile. target: The oldest JRE version you want to support. Be sure to also set bootclasspath to ensure your program will work on older VMs. From the javac documentation: Cross-Compilation Example The following example uses javac to compile code that will run on a 1.6 VM. …

Read more