How to build JRE JRE from source (src.zip in JDK)?

Surprisingly, I could not find the answer to this question.

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

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

Thanks.

+6
java build-process
source share
4 answers

Some of the Java sources that make up rt.jar are generated during the build process, scripts, and other tools. Some of the property files are also that way, and some of the property files are turned into a Java source, which also contributes to rt.jar. Therefore, without doing the full build and populate 'gensrc' first, you will not 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 tell javac about all java files inside src.zip, it will not compile as the dependency graph is broken (missing generated files)

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

+1
source share

You have more chances to use OpenJDK (Oracle / Sun base of future JDKs). http://openjdk.java.net/

But what do you really want to change? Maybe there is a better way ...

+3
source share

If you want to change several classes, you only need to compile these classes. You do not need to compile the entire JDK unless you intend to replace it.

If you just want to fix it, create a JAR of your changed classes and add this to the load class path.

+2
source share

After reviewing the issue. Javac in any of these files will allow you to rebuild them. Also, you do not compile .java files into .java files, they become .class files. You can write an ANT build script to handle the hard work for you.

+1
source share

All Articles