"Original" How to get Java Dynamic generation class?

Source: Internet
Author: User

Writing purposes: Most Java frameworks, such as spring,hibernate, use dynamic proxies to generate new classes when the program is running.

Sometimes in order to learn, or in-depth understanding of dynamic agents, want to see the source code of dynamically generated class how long look,

Through this article, we can easily reach the goal.

Tools: Take advantage of the tools that your JDK comes with.

Related commands: JAVA-CP.; %java_home%/lib/sa-jdi.jar Sun.jvm.hotspot.HSDB

Operation Steps:

1) Open a command-line window to view the JDK installation directory

   

2) Enter the directory

  

3) Enter key commands

  

A swing program will pop up, such as

  

4) File->attach to HotSpot process, and enter the ProcessID to view the Java process

  

  

  

5) After the above steps, the corresponding class file will be generated in the current directory, and finally find an anti-compilation tool (such as Jd-gui) open, you can see the original code.

  

"Original" How to get Java Dynamic generation class?

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.