Java WebAnalysis on development and deployment efficiency
In Java WebProgramThis problem is often encountered during development. To modify a Java file (*. Java), restart the Web server (such as Tomcat and WebLogic) and deploy the project. Starting/stopping servers wastes a lot of time. In small projects, we may not feel it. However, for a company's large-scale projects, such as data centers and production systems, it usually takes several minutes to start/stop. It is a waste of time. If the debugging process of a method in a class is modified multiple times and the server needs to be started and stopped repeatedly, it will waste more time. From the above we can see that we urgently need a tool that can quickly start/stop servers to improve our development efficiency.
1JavarebelIntroduction
Javarebel is a JVM plug-in (-javaagent) that can instantly reload Java class changes. Therefore, you do not need to redeploy an application or restart the container to save developer time. It is a common solution for Java EE and Java independent applications.
Javarebel can be quickly assembled with myeclipse, tomcat, and so on. It can dynamically deploy java files without restarting the server, so as to solve a large amount of development time and improve development efficiency.
2JavarebelIntroduction
The following uses javarebel + myeclipse and javarebel + Tomcat as an example to describe javarebel in project development and deployment environments.
- JavarebelDevelop and deploy applications with myeclipse
1: Download The javarebel plug-in: http://www.zeroturnaround.com/javarebel/download/the current release is 2.0.unzip the downloaded files in any directory (Windows), such as: D: \ javarebel-2.0.
2: Install myeclipse (installation steps are omitted). The personal version is myeclispe5.5.
3: Add javarebel to myeclipse: Open the myeeclispe-> window-> prefrence window, and find JDK settings under the Tomcat location.
Add the following to Java VM parameters:Code:
-Noverify-javaagent: D :\ javarebel-2.0 \ javarebel. Jar
Click "OK.
Next let's take a look at the application of javarebel in the development process (assuming that the Tomcat deployment file {Tomcat} \ conf \ Catalina \ localhost \ <File Name> set in myeclipse. the project linked in XML has been imported in myeclipse ):
After Tomcat is started, modify the Java class file. Then run the program directly (without restarting the server ). In the myeclipe console, red notes are printed, which is automatically printed by javarebel to show you the deployment status of the modified class deployment.
The printing information under the red paint brush is the test information of the Java class I modified. We can see that javarebel has successfully deployed the modified class.
- JavarebelDevelop and deploy applications with Tomcat
1: Download javarebel (omitted ).
2: install Tomcat. Personal use of tomcat5.0.19
3: Configure javarebel in Tomcat: open {Tomcat} \ bin \ Catalina. bat, locate set java_opts, and add the following code on the right of "=:
-Noverify-javaagent: D :\ javarebel-2.0 \ javarebel. Jar
The personal settings are as follows:
Set java_opts =-noverify-javaagent: D: \ javarebel-2.0 \ javarebel. jar-Xms1024m-xmx1024m
4: start Tomcat. After Tomcat is started, modify the Java file in the project linked to the Tomcat deployment description file (XML) (import this project to eclipse for modification). After modification, run the program directly. The following information is displayed on the Tomcat console: