How to debug code from rt.jar with jdk 1.4.1?

xiaoxiao2021-03-05  31

Blom Rt.jar You Will Get Home Information Like "Can't Debug - Absent Line Information." This Small HOWTO WILL TELL You How. Create Your Own Rt.jar (Myrt.jar) - create a directory (newruntime) with a src directory - unzip the jdk source into the src directory - create a new java project with the project contents directory newruntime - let it compile - takes a while - export as a jar file Create a new JRE configuration - prefrences >> Java >> Installed JREs >> Add - Browse to the usual JRE home directory - uncheck "use default system libraries" - add myrt.jar as an external jar above rt.jar Verify - While debuging check the command line ( "Properties" page of the process in the debug perspective) to make sure that myrt.jar is on the boot classpath - if not add myrt.jar to the bootclasspath on the commmandline in your run configurations: -Xbootclasspath / p: C: Dir omy ewruntimemyrt.jar.

And Another Answer:

For the interested here a step-by-step evlanation with script: (1) The bottom line is:

* Get the JDK Source (I DID IT with Version 1.4.1)

* Get the Original RT.jar for the Same Version

* unzip the rt.jar Into a directory OriginalRT

* Unzip the JDK Source Into A Directory RTSource

(2) Now the fun starts:

* Delete All Files from RTSource That Are Not Contained in OriginalRT

(Apparently Old Classes, They Do Not Compile ...)

* Compile the rest of the java files in ib RTSource with the "generate debug

Information "flag (and the RTSource Directory, Dt.jar, Tools.jar and

HTMLCONVERTER.JAR in the classpath)

* Copy All Compiled Classes That Are IN OriginalRT But Not in rtsource Into

The Corresponding Place in RTSource

* Jar RTSource Into a file rt_debug.jar * Use rt_debug.jar instead of rt.jar in Your ClassPath -> ET Voila!

I found a cygwin script on the web doing all the things described in (2),

Here it is in copy you want to use it (thanks to the original creatyl of the

Script!):

#! / Bin / sh # Change these four paths = as required # Base dirJAVA_HOME = / cygdrive / c / j2sdk1.4.1 # Where src.zip was extractedJAVA_SOURCE = / cygdrive / c / JavaSourceCompile / RTSource # Where rt.jar was extractedRT_CLASSES = / cygdrive / c / JavaSourceCompile / OriginalRT # Where to put the compiled classesOUT_DIR = / cygdrive / c / JavaSourceCompile / RTSource # These are the required options for javac, do not changeOPTIONS = "- g -nowarn -sourcepath -d` cygpath. - WP $ out_dir` - Source1.4 - Target 1.4 "SEP ="; "ClassPath = $ java_home / lib / dt.jar $ SEP $ java_home / lib / Tools.jar $ SEP $ java_home / lib / htmlconverter.jarjavac_home = $ java_home / bin # Loop through each java file in the source dircd $ JAVA_SOURCE # $ {JAVAC_HOME} / javac -classpath `cygpath -wp $ CLASSPATH` $ OPTIONS`cygpath -wp ./com/sun/corba/se/ActivationIDL/ActivatorHelper. Java` # / usr / bin / find -name "* .java" | While read java; # do # echo $ java # is this file part of rt.jar, or is it an obsolete source file # EG = COM / Sun /corba/se/internal/interceptors/threadcurrentstack.java# Class = `Echo $ JAVA | SED "S / .Java / .class / g" `# echo $ {r _s} / $ {class} # i [-e $ {r}} / $ {class}]; # Then # # HAS this file Already been compiled # i [{{out_dir} / $ {class}]; #1 # echo already compiled. # Else # $ {javac_home} / javac -classpath `Cygpath -wp $ ClassPath` $ option`cygpath -wp $ Java` # fi # Else # echo obsolete source file. # Fi # Done # Now check for any files That Are In rt.jar But not src.zipcd $ r cs es ur z c... DO if [! -f $ {out_dir} / $ {class}];

then echo Not found: $ CLASS # Uncomment this once the script has been run and all classes havesuccessfully compiled # cp --parents $ CLASS $ OUT_DIR fidoneThat runs for a while, because it's quite some amount of classes - but it

Works!

转载请注明原文地址:https://www.9cbs.com/read-35702.html

New Post(0)