Eclipse debug JDK源码无法看到局部变量
2016-04-05 16:53
483 查看
Generally speaking, to be able to watch the variables while stepping through JDK source code, you need the class files to be compiled with debug information i.e. compile using javac -g.
So your best bet is to either find an already compiled version with debug information (I couldn't find anything for JDK 7) or you can try compiling the source for yourself.
According to this post (please note that I haven't tried it) you don't need to compile all sources, only the ones you need. Putting your newly compiled classes in the $jdk/jre/lib/ext/endorsed directory, the new classes would be used instead the ones in
the original rt.jar.
I believe that should get you started.
Update: Actually I have just tried this process and it is not hard at all. Tested on Windows, JDK 1.7.0_11. All the commands are invoked from command line:
1.Create your working folder. I chose d:\ root folder
2.Inside your working folder create the source folder i.e. jdk7_src and output folder jdk_debug
3.From your JDK_HOME folder get the src.zip file and unzip it inside jdk7_src
4.Select what you will compile and delete the rest. For all of them you might need additional steps. I have chosen the folders:
java
javax
org
5.From your JDK_HOME\jre\lib get the file rt.jar and put in the work folder (this is only for convenience to not specify too large file names in the command line).
6.Execute the command: dir /B /S /X jdk7_src\*.java > filelist.txt to create a file named filelist.txt with the list of all java files that will be compiled. This will be given as input to javac
7.Execute javac using the command:
javac -J-Xms16m -J-Xmx1024m -sourcepath d:\jdk7_src -cp d:\rt.jar -d d:\jdk_debug -g @filelist.txt >> log.txt 2>&1 This will compile all the files in the jdk_debug folder and will generate a log.txt file in your working folder. Check the log contents. You should
get a bunch of warnings but no error.
8.Go inside the jdk_debug folder and run the command: jar cf0 rt_debug.jar *. This will generate your new runtime library with degug information.
9.Copy that new jar to the folder JDK_HOME\jre\lib\endorsed. If the endorsed folder does not exist, create it.
原文地址:http://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is
So your best bet is to either find an already compiled version with debug information (I couldn't find anything for JDK 7) or you can try compiling the source for yourself.
According to this post (please note that I haven't tried it) you don't need to compile all sources, only the ones you need. Putting your newly compiled classes in the $jdk/jre/lib/ext/endorsed directory, the new classes would be used instead the ones in
the original rt.jar.
I believe that should get you started.
Update: Actually I have just tried this process and it is not hard at all. Tested on Windows, JDK 1.7.0_11. All the commands are invoked from command line:
1.Create your working folder. I chose d:\ root folder
2.Inside your working folder create the source folder i.e. jdk7_src and output folder jdk_debug
3.From your JDK_HOME folder get the src.zip file and unzip it inside jdk7_src
4.Select what you will compile and delete the rest. For all of them you might need additional steps. I have chosen the folders:
java
javax
org
5.From your JDK_HOME\jre\lib get the file rt.jar and put in the work folder (this is only for convenience to not specify too large file names in the command line).
6.Execute the command: dir /B /S /X jdk7_src\*.java > filelist.txt to create a file named filelist.txt with the list of all java files that will be compiled. This will be given as input to javac
7.Execute javac using the command:
javac -J-Xms16m -J-Xmx1024m -sourcepath d:\jdk7_src -cp d:\rt.jar -d d:\jdk_debug -g @filelist.txt >> log.txt 2>&1 This will compile all the files in the jdk_debug folder and will generate a log.txt file in your working folder. Check the log contents. You should
get a bunch of warnings but no error.
8.Go inside the jdk_debug folder and run the command: jar cf0 rt_debug.jar *. This will generate your new runtime library with degug information.
9.Copy that new jar to the folder JDK_HOME\jre\lib\endorsed. If the endorsed folder does not exist, create it.
原文地址:http://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is
相关文章推荐
- 神器SystemTap
- MyEclipse Web Project转Eclipse Dynamic Web Project
- Windows Clang开发环境备忘
- Ubuntu 安装 JDK 问题
- Python 七步捉虫法
- Lua编程示例(一):select、debug、可变参数、table操作、error
- C#中的两种debug方法介绍
- 傻瓜式用Eclipse连接MySQL数据库
- 用Ruby实现一个单元测试框架的教程
- Eclipse引入jquery报错如何解决
- 让Flex Builder 3.0与Eclipse3.4整合起来
- js调试工具 Javascript Debug Toolkit 2.0.0版本发布
- Eclipse配置Javascript开发环境图文教程
- 使用zend studio for eclipse不能激活代码提示功能的解决办法
- 图解Eclipse j2ee开发环境的搭建过程
- 两种Eclipse部署动态web项目方法
- ext for eclipse插件安装方法
- php debug 安装技巧
- 解决Fedora14下eclipse进行android开发,ibus提示没有输入窗口的方法详解
- eclipse导入jquery包后报错的解决方法