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
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.