First attempt Java Virtual Machine debug-start Hsdb

Source: Internet
Author: User

I am recently learning Java Virtual machine, and HSDB is the only way to learn Java virtual machine, so today tried to hsdb debugging.

First of all, I learned from Daniel Big article: Borrow Hsdb to explore the hotspot VM Runtime data, and the significance of this article is to help me as I want to learn Java virtual machine but usually too dependent on the IDE's classmates. My environment is JDK8. Nonsense not much to say, direct.

1. Create and Compile code

650) this.width=650; "title=" QQ picture 20170509223811.png "Src=" https://s3.51cto.com/wyfs02/M00/95/21/ Wkiom1kr1matgcxmaaacngehb7s338.png-wh_500x0-wm_3-wmp_4-s_319415952.png "alt=" Wkiom1kr1matgcxmaaacngehb7s338.png-wh_50 "/>

Due to the usual use of eclipse, if not well equipped with path, javahome and classpath to be well first, and then cmd into the project directory, my package is hsdb, need to go into the hsdb of the superior directory, to perform the compilation:

650) this.width=650; "title=" QQ picture 20170509224928.png "Src=" https://s2.51cto.com/wyfs02/M02/95/21/ Wkiol1kr11dyteumaaanrrx-wxe775.png-wh_500x0-wm_3-wmp_4-s_585189790.png "alt=" Wkiol1kr11dyteumaaanrrx-wxe775.png-wh_50 "/>

2.jdb Debug Code and Pause

Both Ps:jdb,jps and Sa-jdi.jar are in the JDK Lib and bin directories

650) this.width=650; "title=" QQ picture 20170509225459.png "Src=" https://s5.51cto.com/wyfs02/M01/95/21/wKioL1kR2GfzmZr_ Aablrjsxstm844.png-wh_500x0-wm_3-wmp_4-s_3100643040.png "alt=" Wkiol1kr2gfzmzr_aablrjsxstm844.png-wh_50 "/>

3. Use JPS to view the Java program PID

The cmd window remains fixed, reopen a new CMD window, use JPS to view the Java program's process number and perform subsequent HSDB startup operations

650) this.width=650; "title=" QQ picture 20170509230303.png "Src=" Https://s3.51cto.com/wyfs02/M01/95/21/wKioL1kR2k_ Ydex7aaacpwavt80472.png-wh_500x0-wm_3-wmp_4-s_3428927772.png "alt=" wkiol1kr2k_ydex7aaacpwavt80472.png-wh_50 "/ >

In the figure we can see that the PID of main is 18392.

4. Start Hsdb

Note: Most of our Java is installed in the C:\Program files down Road This full classpath path needs to be escaped with double quotes, such as:

650) this.width=650; "title=" QQ picture 20170509230935.png "Src=" https://s2.51cto.com/wyfs02/M02/95/21/ Wkiol1kr283z3louaaao5aj3p_k669.png-wh_500x0-wm_3-wmp_4-s_1782363628.png "alt=" wKioL1kR283z3louAAAo5aj3P_ K669.png-wh_50 "/>

After executing this command, our Hsdb tool should start. But when I started it, I reported an error: Exception in thread "Thread-1" Java.lang.UnsatisfiedLinkError:Can ' t load library:d:\program Files\java \xxx\sawindbg.dll. Refer to the following article for the resolution of HSDB, about resolving unsatisfiedlinkerror sawindbg.dll problem notes.

Then we can link to the process with the PID number.

650) this.width=650; "title=" QQ picture 20170509232013.png "Src=" https://s3.51cto.com/wyfs02/M01/95/22/ Wkiol1kr3ltyogn8aabwdv4j4he922.png-wh_500x0-wm_3-wmp_4-s_4129247002.png "alt=" Wkiol1kr3ltyogn8aabwdv4j4he922.png-wh_50 "/>


650) this.width=650; "title=" QQ picture 20170509232219.png "Src=" https://s2.51cto.com/wyfs02/M00/95/22/ Wkiol1kr3sqcwrizaacnrsoytds064.png-wh_500x0-wm_3-wmp_4-s_1859168794.png "alt=" Wkiol1kr3sqcwrizaacnrsoytds064.png-wh_50 "/>

650) this.width=650; "title=" QQ picture 20170509232332.png "Src=" https://s1.51cto.com/wyfs02/M00/95/22/ Wkiom1kr30jyjaalaabub4kfvjm688.png-wh_500x0-wm_3-wmp_4-s_3950191431.png "alt=" Wkiom1kr30jyjaalaabub4kfvjm688.png-wh_50 "/>


At this point, our HSDB tool has been connected to our Java process and can be further debugged. This article is intended to help the first time use HSDB debugging students to crawl the pit, and to make a note for themselves.

This article is from the "Instant Hua Fang" blog, please be sure to keep this source http://9903567.blog.51cto.com/9893567/1923901

First attempt Java Virtual Machine debug-start Hsdb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.