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?