Eclipse debugging source code

1. Make a debuggable rt.jar package

1.1. Create two new folders, jdk7_src and jdk7_rt-debug, on the C drive

1.2. Copy the JDK source code

Set the java_home address configured in the environment variable or the src.zip in the external JDK installation directory to be used

Copy it to C:/jdk7_src and decompress it. The effect is as follows

1.3. Select the source code to compile

Delete the content of swing, otherwise the compilation will report an error, and others can be at will.

Swing package directory location: com\sun\java\swing, javax\swing

1.4. Get the java file name to be processed

Order:

cd C:\jdk7_src

dir /B /S /X *.java > filelist.txt 

1.5. Copy jre/lib/rt.jar

Copy the rt.jar under jre/lib in the JDK installation directory (the directory where src.zip is copied) to the jdk7_src directory

1.6. Generate some debuggable class folders

Execute the following command. After success, the jdk7_rt-debug folder will generate some debuggable class folders, as shown below:

If not, please open jdk7_src/log.txt, ctrl+F to find "error", and solve it.

Generally, delete the error java path and the file corresponding to the path, and then execute dir /B /S /X *.java > filelist.txt.

javac -J-Xms16m -J-Xmx1024m -sourcepath C:\jdk7_src -cp C:\jdk7_src\rt.jar -d C:\jdk7_rt-debug 

-g @filelist.txt >> log.txt 2>&1

1.7. Package these files into Jar

Switch the directory to jdk7_rt-debug and execute the command

jar cf0 rt_debug.jar *

2. Use debuggable rt.jar

2.1. Put rt_debug.jar into JDK

Put into java_home/jre/lib/endorsed directory

2.2. Add rt_debug.jar to the JDK used by Eclipse

2.3. Add the source package of rt_debug.jar

get it

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325217334&siteId=291194637