Switching JRebel Agents

JRebel comes bundled with two agents – the JRebel Agent and the Legacy Agent (which can be found in the legacy folder). Unless configured, JRebel defaults to using the JRebel Agent.

You can switch back to the Legacy Agent when necessary. This can be done from the IDE settings (when using a JRebel IDE plugin) or from the command line.


When running your server or application via IDE

  1. Open Help > JRebel > Configuration.
  2. Find the Advanced tab.
  3. Select the option to use Legacy Agent.
  4. Restart your application server.

Note

If you need to switch back to the newer JRebel Agent, access the Advanced tab again and select JRebel Agent. Do not forget to restart your application server after that.


When running your server or application from a command line

To enable the Legacy Agent for standalone applications, you need to add the library using either -agentpath or -javaagent JVM options.

Note

Two JRebel Agents are provided when downloading the standalone ZIP file:

  • ./jrebel.jar – This is the JRebel Agent.
  • ./legacy/jrebel.jar – This is the Legacy Agent.

Switching JRebel Agents on Windows, Mac OS and Linux (x86)

Add -agentpath:[path/to/jrebel] to the JVM command line.

Operating system Startup command
Windows 64-bit JDK java -agentpath:c:\JRebel\lib\jrebel64.dll com.example.Main
Windows 32-bit JDK java -agentpath:c:\JRebel\lib\jrebel32.dll com.example.Main
Mac OS X 64-bit JDK java -agentpath:/Users/user/jrebel/lib/libjrebel64.dylib com.example.Main
Mac OS X 32-bit JDK java -agentpath:/Users/user/jrebel/lib/libjrebel32.dylib com.example.Main
Linux 64-bit JDK java -agentpath:/Users/user/jrebel/lib/libjrebel64.so com.example.Main
Linux 32-bit JDK java -agentpath:/Users/user/jrebel/lib/libjrebel32.so com.example.Main

Switching JRebel Agents on other operating systems and architectures

Java 6 to 8:

java -javaagent:[/path/to/]jrebel.jar -Xbootclasspath/p:[/path/to/]jrebelboot.jar [... rest of arguments ...]

Java 9 and newer:

REBELBOOT=/path/to/jrebelboot
mkdir -p $REBELBOOT
touch $REBELBOOT/patches.txt
java -javaagent:[/path/to/]jrebel.jar -Drebel.bootstrap=$REBELBOOT @$REBELBOOT/patches.txt [... rest of arguments ...]