Javarebel gives Java a dynamic Reload class feature. Although there are some limitations, it can significantly increase the speed of development. Javarebel allows an application (independent or run on the application server) to reload most of the class changes that occur during the run, including adding or removing methods and domains. Save a lot of work.
Javarebel is a JVM plug-in that is simple to use and takes only two steps: adding Javarebel.jar to Classpath (Javarebel.jar is not recommended under Web-inf/lib because the production environment does not need it) The following startup parameters are added to the command line
Java-noverify-javaagent:c:/libraries/javarebel.jar-drebel.dirs=c:/workspace/project/classes
Drebel.dirs point to the directory of the. class file in the project, without specifying a specific class name. In addition, Javarebel.jar's name cannot be modified.
Specific content can refer to its official website: http://www.zeroturnaround.com/javarebel/ installation Using Javarebel installation Java 5 or Later Java 1.4 IDE configuration instructions per container Advanced configuration Javarebel plugins Using javarebel
Javarebel is a developer tool that would reload changes to compiled Java classes on-the-fly the ' time ' it saving t o Redeploy an application or perform a container restart. It is a generic solution which works for Java EE and Java standalone applications.
Javarebel installs as a JVM plugin (-javaagent) and works by monitoring the timestamp of class files. When it's updated (e.g. when a developer saves a class from the IDE) Javarebel'll reload the changes to class code and Structure while preserving all existing class instances. The loading is lazy and would happen upon usage of the class (method call on a instance, static call on the class, field L Ookup etc).
The following classes is reloaded when they are changed and Compiled:all ". Class" classes inside the usual (web-inf/classes, etc). Using this and exploded deployment would provide the best javarebel experience. All '. class ' files in directories specified By-drebel.dirs (comma-separated list) JVM command line. With this, can deploy in unexploded development mode (EAR or WAR) and still reload classes. For Example-drebel.dirs=/path/to/eclipse/project-one/bin,/path/to/eclipse/project-two/bin. However New classes (or renamed old classes) won't is loaded before the They also appear in the classpath (e.g. after the B Uild in JAR files).
Example:java EE exploded development
You are developing a Java EE application. You are are using exploded development and have deployed the root of your project to the container. The container is loading your classes from web-inf/classes. You are have installed Javarebel to the container.
To take advantage of the-situation with Javarebel the developer has to start compiling the class files straight to Web-in F/classes and instead of redeploying the application Javarebel would reload code changes. Example:java EE unexploded development (WAR or EAR)
You are developing a Java EE application. You are are using unexploded development and have deployed a WAR archive to the container. You are would like to change Java source files and the changes propagate without redeploy. You are are compiling your classes to c:/projects/app/build/classes.
To take advantage of the-situation with Javarebel the developer has to start the container with Javarebel and also Y the location of the classes, thus-drebel.dirs=c:/projects/app/build/classes. Javarebel'll now reload new classes this are compiled to c:/projects/app/build/classes. Example:java SE Development
You are developing a Java SE Swing application. You are are compiling and starting it from a IDE with all compiled classes being in System classpath. In this case adding the Javarebel installation command line to the started application'll immediately enable class Reloa Ding. More Examples: Developing in exploded format developing in unexploded format Javarebel Tutorial to Tomcat on Windows developing Swing WI Th Javarebel Javarebel and IntelliJ idea Javarebel boosting Eclipse Plugin Development installation Java 5 or Later
Add the following to JVM command line (note This It is important this JAR would be named "Javarebel.jar")
-noverify-javaagent:/path/to/javarebel.jar
Windows examples Java-noverify-javaagent:c:/libraries/javarebel.jar-drebel.dirs=c:/workspace/project/classes Com.domain.Application java-noverify-javaagent:c:/libraries/javarebel.jar-drebel.dirs=c:/workspace/project/ Classes-jar Application.jar
Linux examples java-noverify-javaagent:/home/john/libs/javarebel.jar-drebel.dirs=/home/john/workspace/project/ Classes Com.domain.Application java-noverify-javaagent:/home/john/libs/javarebel.jar-drebel.dirs=/home/john/ Workspace/project/classes-jar Application.jar Java 1.4
The installation for Java 1.4 has two parts:generating a bootstrap jar adding commandline options to the JVM Generati ng the bootstrap jar
Running Java-jar/path/to/javarebel.jar would generate a javarebel-bootstrap.jar. The file is generated to the folder where Javarebel.jar resides.
important! Javarebel-bootstrap.jar is JVM and Javarebel version specific! If You are upgrade your JVM (even a minor version) or upgrade Javarebel you have to regenerate.
important! Make sure this JVM version used to generate Javarebel-bootstrap.jar is the same your application'll run with!
Example Java-jar C:/libraries/javarebel.jar-will generate a Javarebel-bootstrap.jar into the folder C:/libraries/java -jar/home/john/lib-will generate a Javarebel-bootstrap.jar into the Folder/home/john/lib
Note The easiest way to ensure JVM and Javarebel version consistency are to add the Javarebel-bootstrap.jar generation to the St Artup script of your application server. This means about every startup the Javarebel-bootstrap.jar is generated with the JVM, which is used to start the server. This is a inexpensive invocation and is noticeable. adding commandline options to the JVM
Javarebel requires the Javarebel-bootstrap.jar and Javarebel.jar to being prepended to the Java Bootclasspath as as the -noverify JVM flag:
-noverify-xbootclasspath/p:/path/to/javarebel-bootstrap.jar:/path/to/javarebel.jar
Windows examples Java-noverify-xbootclasspath/p:c:/libraries/javarebel-bootstrap.jar; C:/libraries/javarebel.jar-drebel.dirs=c:/workspace/project/classes com.domain.Application Java-noverify- Xbootclasspath/p:c:/libraries/javarebel-bootstrap.jar; C:/libraries/javarebel.jar-jar-drebel.dirs=c:/workspace/project/classes Application.jar
Linux examples java-noverify-xbootclasspath/p:/home/john/libs/javarebel-bootstrap.jar:/home/john/libs/ Javarebel.jar-drebel.dirs=/home/john/workspace/project/classes com.domain.Application Java-noverify- xbootclasspath/p:/home/john/libs/javarebel-bootstrap.jar:/home/john/libs/javarebel.jar-drebel.dirs=/home/john/ Workspace/project/classes-jar Application.jar Successful installation check
On successful installation you should to the following message in standard output.
##########################################################
zeroturnaround javarebel x.y.z
...
##########################################################
Features for supported JVM and server versions.
IDE Configuration
If you are are using IntelliJ idea you should install this plugin to enable debugging with Javarebel. You are should also configure your IDE for better debugging. instructions per container
Further can find specific instructions for different operating systems, application servers and. To keep the instructions concise we don ' t include the-drebel.dirs option in the following installation.