Is the compiler of Java Bootstrapped ?
How was the first compiler of java written if it is bootstrapped ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s an interesting question. The current
javaccompiler from Oracle, which is only one compiler of many (1), is actually written in Java which means, yes, you could consider it bootstrapped, assuming your definition means “has been bootstrapped so that it can now compile itself” (2).The virtual machine itself is written mostly in C++ from memory so, while the compiler is bootstrapped, building the JRE requires a C++ compiler.
(1) GCJ is another one, and it happens to be written in C, so it depends on which compiler you’re referring to.
(2) The single word “bootstapped” in your question could be taken in a number of ways. If your definition of “bootstrapped” means “has to be bootstrapped to get a working compiler”, then the answer is no.
As to how the first Java compiler was written before bootstrapping, that remains lost in the mists of time (or the minds of Gosling et al).
Given that a compiler can be written relatively easily without any of the fancy OO concepts, my guess would be that they simply wrote the first one (or few) in C or C++.
That seems borne out by this entry from the Wayback Machine:
and, later:
In addition, from Patrick Naughton’s epilogue in his book “The java Handbook” (my bold):
So, it looks like the original version of the “Java” (Oak) compiler was written in C, then bootstrapped from there.