Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Ant script to recompile the JDK runtime with full debug symbols
<project name="create rt_debug.jar" default="makejar" basedir=".">
<target name="init">
<property environment="env"/>
<property name="project.build" location="build"/>
<property name="project.src" location="${project.build}/src"/>
<property name="project.classes" location="${project.build}/classes"/>
<property name="project.dist" location="${project.build}/dist"/>
<path id="project.classpath">
<fileset dir="${env.JAVA_HOME}/jre/lib">
<include name="*.jar"/>
</fileset>
</path>
</target>
<target name="clean" depends="init">
<delete dir="${project.build}" quiet="true"/>
<mkdir dir="${project.build}"/>
</target>
<target name="unpack" depends="init, clean">
<unzip src="${env.JAVA_HOME}/src.zip" dest="${project.src}"/>
</target>
<target name="build" depends="unpack">
<mkdir dir="${project.classes}"/>
<javac srcdir="${project.src}" classpathref="project.classpath"
destdir="${project.classes}" debug="on" includeAntRuntime="false"
fork="true" memoryMaximumSize="4096m" failonerror="false">
</javac>
</target>
<target name="makejar" depends="build">
<mkdir dir="${project.dist}"/>
<copy file="${env.JAVA_HOME}/jre/lib/rt.jar" tofile="${project.dist}/rt_debug.jar"/>
<jar jarfile="${project.dist}/rt_debug.jar" update="true" compress="true">
<fileset dir="${project.classes}"/>
</jar>
<echo>
Debug library built. You can find it at ${project.dist}/rt_debug.jar. Use any of the following methods to make use of it:
- copy it to ${env.JAVA_HOME}/jre/lib/endorsed/ (create the directory if it doesn't exists)
- use the -Xbootclasspath property to specify this jar
- overwrite ${env.JAVA_HOME}/jre/lib/rt.jar with it (backing up the original is highly recommended!)
</echo>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment