NB! The javarebel-bootstrap.jar is specific to the JVM version and JavaRebel version so be sure to regenerate every time the JVM or JavaRebel version changes! Also make sure that the JVM version you generate with is the same your application will run with! We suggest to add bootstrap generation command to the application/server startup script if possible.
With any Java version if you use an IDE that compiles classes on-the-fly set -Drebel.dirs property to point to the output folder, for example:
-Drebel.dirs=/home/user/workspace/project/bin
Start the server or application as usual. If JavaRebel integration was successful you should see a message like this:
See Features for supported JVM and server versions.
Configuration
The following classes will be reloaded
All ".class" classes inside the usual classpath (WEB-INF/classes, etc). Using this with exploded deployment will provide the best JavaRebel experience.
All ".class" classes in directories specified "-Drebel.dirs" comma-separated list JVM command line property. With this you can deploy in unexploded development mode (EAR or WAR) and still reload classes instantly. For example -Drebel.dirs=/path/to/eclipse/project-one/bin,/path/to/eclipse/project-two/bin. However new classes (or renamed old classes) will not be loaded before they also appear in the classpath (e.g. after the build in JAR files).
If you are using IDEA you should install this plugin to enable debugging with JavaRebel. You might also want to configure your IDE for better debugging experience.
If you have any problems with dynamic proxies (JDK, CgLib, Javassist) add "-Drebel.forbid_bypass=true" to the JVM command line to improve compatibility.
Platform-specific
Further you can find specific instructions for different operating systems, application servers and so on.
Search for jvm-options element and add the elements
-noverify and
-javaagent:javarebel.jar
Start the domain as usual.
Maven/Jetty
You can also use JavaRebel with Maven Jetty plugin.
Edit your pom.xml file and set the scanIntervalSeconds param to 0, this will turn off Jetty's internal reloading. Jetty's internal reloading won't keep your session after reloading changed classes.
Start jetty with the maven jetty plugin and the MAVEN_OPTS parameter set
Since Jetty does not have any startup scripts just add the following line to the command line:
-noverify -javaagent:javarebel.jar
Caucho Resin 3.0.x
Copy javarebel.jar to RESIN_HOME/ folder.
Windows
Start httpd.exe with parameters
httpd.exe -J-javaagent:javarebel.jar -J-noverify
Linux
Modify RESIN_HOME/bin/wrapper.pl $JAVA_ARGS variable to include the line:
-javaagent:javarebel.jar -noverify
Other
If JavaRebel doesn't work with your application or container it is most probably due to some custom classloaders that don't behave exactly as we expect them to. You need to determine the class name of the classloader in question. The easiest way to do it is put the following line in any class that will be loaded by that classloader (e.g. in a web application case it could be a servlet class):
This will print the name of the classloader class right out to the console. Let's assume the name was "com.acme.CustomClassLoader". In that case all we need to do is pass it to the JavaRebel agent like this:
To generate the javarebel-bootstrap.jar just run java -jar javarebel.jar using the JVM you will run the application with.
Edit your pom.xml file and set the scanIntervalSeconds param to 0, this will turn off Jetty's internal reloading. Jetty's internal reloading won't keep your session after reloading changed classes.
Start jetty with the maven jetty plugin and the MAVEN_OPTS parameter set
Java 1.4 legacy installation mode supports JavaRebel in reduced functionality mode only. For example added methods will not be visible via Reflection API. Please use new intallation mode where possible.
Java 1.4 legacy installation mode supports JavaRebel in reduced functionality mode only. For example added methods will not be visible via Reflection API. Please use new intallation mode where possible.
Download javarebel-x.y.z.jar. Put it in the domain directory (e.g. user_projects/domains/mydomain). Modify the startWebLogic.cmd. Prepend javarebel-x.y.z.jar to WebLogic classpath (you can rename it to javarebel.jar to make upgrading easier):
set CLASSPATH=javarebel-x.y.z.jar;%CLASSPATH%
Note that it is important for javarebel-x.y.z.jar to be the first entry in the classpath!
NB! Due to a bug in JRockit JVM you will need version 8.1sp6 or later for JavaRebel to function successfully! This problem does not affect other JVMs (e.g. Sun JVM)
Oracle Container for Java EE 9.x
Java 1.4 legacy installation mode supports JavaRebel in reduced functionality mode only. For example added methods will not be visible via Reflection API. Please use new intallation mode where possible.
Windows & Linux
We assume that javarebel.jar is located under OC4J_HOME/j2ee/home and for starting
OC4J without JavaRebel the standard java -jar oc4j.jaris used.
Run java -cp javarebel.jar com.zeroturnaround.javarebel.oc4j9.Install
Use java -cp javarebel.jar:oc4j.jar com.evermind.server.OC4JServer to start the container.
Oracle Container for Java EE 10.x
Java 1.4 legacy installation mode supports JavaRebel in reduced functionality mode only. For example added methods will not be visible via Reflection API. Please use new intallation mode where possible.
Linux
We assume that javarebel.jar is located under OC4J_HOME/bin and for starting
OC4J without JavaRebel the standard oc4j -start is used.
This will start the container as usual but also includes the JavaRebel integration.
Tomcat 4
Java 1.4 legacy installation mode supports JavaRebel in reduced functionality mode only. For example added methods will not be visible via Reflection API. Please use new intallation mode where possible.
This configuration assumes that javarebel.jar is located under CATALINA_HOME/bin directory.
Windows
File: %TOMCAT_HOME%\bin\catalina.cmd
Add the following line just before "rem Execute Java with the applicable properties":
set JAVA_OPTS=-noverify %JAVA_OPTS%
set CLASSPATH=javarebel.jar;%CLASSPATH%
"%JAVA_HOME%\bin\java.exe" -cp "%CLASSPATH%;..\server\lib\catalina.jar" \
com.zeroturnaround.javarebel.tomcat.Install
Linux
File: $TOMCAT_HOME/bin/catalina.sh
Add the following line just after elif [ $1? = "start" ] ; then: