Original address: Https://marcin-chwedczuk.github.io/debugging-openjdk8-with-netbeans-on-ubuntu
The overview is as follows:
1 is of course download openjdk. I chose jdk8u, which is the mainstream version of the current major companies, in addition Jdk9 and JDK10 directory structure compared with the traditional directory structure has changed, from the existing data to find the relevant code will increase the difficulty. Two ways to download:
1) HG clone http://hg.openjdk.java.net/jdk8u/jdk8u/. (Note the period of the current directory behind this code), and then execute the downloaded get_source.sh script after this step is completed.
2) Download the full source code from HTTPS://GITHUB.COM/DMLLOYD/OPENJDK using Git or other means.
2 Download the dependencies to be used to compile the source code.
sudo apt install
libx11-dev
libxext-dev
libxrender-dev
libxtst-dev
libxt-dev
libcups2-dev
libfreetype6-dev
libasound2-dev
(另外提一句,如果有哪位同学跟我一样使用的opensuse系统,最后那个libasound2-dev包是找不着的:可以安装alsa这个包替代)
$ cd openjdk-jdk8u/
$ chmod +x ./configure
4编译
make
5 Running our Java program
0) Prepare a Helloworld.class file
1) $ ./build/linux-x86_64-normal-server-slowdebug/jdk/bin/java -cp "/home/me/dev/java/helloWorld/" HelloWorld (第一个参数是你上步编译出的java可执行程序,第二个参数是classpath,这里指向你放class文件的目录,第三个是含有main方法的类名。
Hello, world!(这是输出)
6 run and debug our openjdk with NetBeans. If you want to do this, you can omit the 3,4,5 step.
1) Download NetBeans from the official website and request support for C + +.
2) Create a new C + + project and import from the existing source.
3) Configure and run the Configure script.
4) When the configuration is complete, the project automatically runs make.
5) Specify executable Java programs such as 5.1 when the build is complete.
6) Set a breakpoint in the source code and click on the Debug button (if there is a signal interrupt pop-up box, select "No longer receive this signal" and "go forward.")
These steps are relatively brief, because the citation author has been very careful to give. It is no longer a reason.
7 plus the location of the breakpoint.
Refer to https://www.cnblogs.com/bhlsheji/p/4017816.html this blog post.
Reprint: Debugging OpenJDK 8 with NetBeans on Ubuntu