I want to compile jdk files in order to include debug infromation.
I'd like to use ant, because it's included in my NetBeans environement, so i've done the following:
- unzipped /src.zip in a tmp directory
- created a very simple build.xml file (one default target, one taks) in my tmp directory:
<?xml version="1.0" encoding="UTF-8"?> <project name="CompileJDK" default="default" basedir="."> <target name="default"> <javac srcdir="." destdir="jdkwd" debug="on" /> </target> </project>
- created a jdkwd directory
- launched ant without parameters (just >log.txt)
This leads to 100 compilation errors such as:
[javac] C:\jdkdebug\java\awt\Window.java:196: cannot find symbol
[javac] symbol : class IdentityArrayList
[javac] location: class java.awt.Window
[javac] private static final IdentityArrayList<Window> allWindows = new IdentityArrayList<Window>();
I have just one JDK installed on my machine, so i don't know why it does not resolve all this references.
UPDATE: The majority of these unresolved references belongs to the package:
sun.awt.util
The question now is corrected to: where are the missing jdk files?
Try adding a classpath to your javac call.
Also, try running ant with the -d and -v options. It's a lot of output but will show you where its searching for classes.
Building the JDK itself is a complex process and is not achievable by a simple
javac
call wrapped inside anant
project.You should look at the OpenJDK Build README to get instructions on how to build for your platform.
According to this post (from 2007), you should include rt.jar and tools.jar on your classpath to compile the JRE sources.
However, I tried that, and it doesn't work for me (100 errors).
There are more elaborate and older (2004) instructions in christhielen's post in the Java bug requesting debug symbols.
If you use Gentoo compiling OpenJDK would be as simple as running
emerge dev-java/icedtea
.There is a
debug
use flag that would switch off all optimizations, I haven't tried it myself but chances are that this is what you want. If it's not - then it should not be a big deal to change build scripts, but would require you to learn a little bit of portage.http://www.oracle.com/technetwork/java/faq-141681.html
The community source code link is incorrect: it's now http://download.java.net/openjdk/jdk7/