Search code examples
javabuild-process

How does one build the java JRE from source (src.zip in JDK)?


Surprisingly enough I couldn't find the answer to this question.

I am trying to rebuild the java JRE from source. I obtain the java JRE source by extracting the src.zip file in the JDK.

After making any changes I need to make to the JRE, how do I compile the new source back into .java files (after which I can compress it into the rt.jar file).

Thanks.


Solution

  • Some of the Java sources that make up rt.jar are generated during the build process, from scripts and other means. Some of the properties files are also generated this way, and some of the properties files are turned into Java source that also contributes to rt.jar. So without doing a complete build first and populating the 'gensrc' directory, you won't have all the sources that make up rt.jar.

    Taken from: http://www.java.net/forum/topic/jdk/java-se-snapshots-project-feedback/it-possible-just-build-rtjar

    So when you say javac on all the java files inside src.zip it won't compile as the dependency graph is broken (missing generated files)

    Also have a look at this: Where to get full source code for rt.jar?