In the answer Platform independence in Java ByteCode, it is said that Java Compiler is same across all the platforms. I do understand that.
My question is that why Java compiler is distributed as an .exe file (for windows) then? Why not as JVM bytecode to be executed by JRE. This way there wont be different version of the compiler for different platforms. I don't know if it is even possible?
javac.exe
(on my installation, JDK 1.8 on Windows x64) is about 15K in size. This isn't the full compiler. The compiler itself really is written in Java, and javac.exe
is just a launcher, effectively. This is true of many of the tools that come with Java - it would be a pain to have to run something like:
java -cp path/to/javac.jar java.tools.Javac -cp path/to/your/libraries Foo.java
for example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With