There have been some problems with debugging the debugger in debug mode recently, and it's depressing to modify Java classes and even modify HTML to restart Tomcat. Found a good thing in the Internet search.
Do not have to know a use startled, really quickly, the development efficiency has greatly improved. Original:
Hostswap DCEVM
What is DCEVM
DCEVM (dynamiccode Evolution virtual Machine) is a Java hostspot patch (strictly modified), allowing (not unrestricted) the modification of loaded class files in a running environment. The current virtual machine only allows modifying the method body ( Method bodies), DECVM, can increase the deletion of class properties, methods, and even change the parent class of a class. Principle See dynamic Code Evolution for Java DCEVM principle
DCEVM is an Open-source project that complies with the GPL 2.0. source files and executable files can be downloaded from the official website.
Note: Currently, the binary version of the VM is available for the 32-bit and 64-bit Windows vm, 32-bit Mac OS soylatte vm (g ET it here), and 32-bit Linux VM. We binaries for 64-bit Mac and Linux vms.contact us, if your are interested in them.
Installation
Warning: The patch is still in the experimental phase. When the patch is used to debug Java programs, it is fairly stable. However, this patch is not advocated for use in a production environment.
1. Download the installation file (download address)
2. Execute installation files
#windows
> Java-jar Dcevm-0.2-win.jar
#mac
$ sudo java-jar Dcevm-0.2-mac.jar
#linux
$ sudo java-jar Dcevm-0.2-linux.jar
Select the path, and the execution install is complete. Figure: View Installer source found the installation process is to copy some files to the appropriate location:
32-bit Windows |
Replace the Java Bin/client/jvm.dll and Bin/server/jvm.dll with the files in the data/bin/directory, and then back up the Jvm.dll to the appropriate directory. Add Data/dcevm.jar to the/jre/lib/ext/directory |
64-bit Windows |
Copy Data/64/bin/server/jvm.dll to Bin/server/jvm.dll Add Data/dcevm.jar to the/jre/lib/ext/directory |
32-bit Linux |
If the jre/lib/i386/client/directory exists: Copy data/lib/i386/client/libjvm.so to jre/lib/i386/client/libjvm.so If the jre/lib/i386/server/directory exists: Copy data/lib/i386/server/libjvm.so to jre/lib/i386/server/libjvm.so Add Data/dcevm.jar to the/jre/lib/ext/directory |
64-bit Linux (not supported temporarily) |
Copy data/64/lib/amd64/server/libjvm.so to jre/lib/amd64/server/libjvm.so () Add Data/dcevm.jar to/jre/lib/ext/directory |
Attention:
Dcevm.jar to copy to the JRE directory, if Java is specified to run on the JDK, this directory is the JRE directory under the JDK.
The Linux installation file does not data/64 this directory, meaning that 64-bit Linux is not installed properly? Cup, Ah, have time to try to see how to deal with.
Children's shoes that cannot be installed through a graphical interface under Linux can manually copy files.
Debugging Java
Two ways to debug: Debug mode start Java program && Eclipse Remote Debug Eclipse Debug mode startup program
Note the problem (more questions added):
1. Static properties that are dynamically added in the program, such as private static String a = "X", show that A is null when invoked.
2. In an ongoing cycle, some changes cannot take effect, such as:
public static void Main (string[] args) {
for (int i = 0; i < 10000; i++) {
Test ();//sleep 1s and print something
}
}
Modified to:
public static void Main (string[] args) {
for (int i = 0; i < 10000; i++) {
Test ();
SYSTEM.OUT.PRINTLN ("xxx");
}
}
XXX cannot be exported, but the modification within the test method body can take effect.
Or:
public static void Main (string[] args) {
SYSTEM.OUT.PRINTLN ("xxx");
for (int i = 0; i < 10000; i++) {
Test ();
}
}
Original address:
Http://www.cnblogs.com/redcreen/archive/2011/06/03/2071169.html