Page tree
Skip to end of metadata
Go to start of metadata

This page describes how to install JRebel and configure IntelliJ IDEA to use it. JRebel is a tool that allows you to compile and reload Java classes without restarting your application. In essence, it makes Java web application development very similar to developing with Rails and Grails (from a save/reload perspective). It gives you zero turnaround, which is something all web frameworks should support.

  1. Download and install IntelliJ IDEA 9 Ultimate Edition (in /Applications on OS X).
  2. Download and install JRebel.
    1. java -jar jrebel-setup.jar
    2. Install the JRebel Plugin for IDEA. Shortcut: File > Settings > Search for plugins and find JRebel.
  3. On OS X, Modify /etc/launchd.conf and add the following so M2_HOME is available to GUI apps. You'll need to reboot after making this change.
    More info on this setting is available on Stack Overflow.
  4. Modify your project's pom.xml to include the JRebel Maven plugin (for generating the configuration of which directories and files to watch for changes).
  5. Change your pom.xml so Jetty doesn't reload the app when classes are compiled. Specifically, change <scanIntervalSeconds>3</scanIntervalSeconds> to <scanIntervalSeconds>0</scanIntervalSeconds>.
  6. Use the JRebel icons to start jetty:run in your IDE.
  7. (Optional) Set a JREBEL_HOME environment variable that points to your JRebel install (/Applications/ZeroTurnaround/JRebel on OS X) and set your MAVEN_OPTS to use JRebel's settings (for using JRebel running it from the command line). For example:

After making these changes, you should able to compile classes in IDEA and refresh your browser. Log messages like the following should show up in your console.

To simplify things further, you can map Command+S to compile (instead of Shift+F9). Just look for Keymaps in Settings, rename the default one and search for Compile to remap.