AppEngine, JRebel and Eclipse - Getting them to work together

Wednesday 29 September 2010

I recently started using JRebel for development, but initially I had a bit of trouble getting it to gel with the App Engine / Eclipse setup. After an email or two with the guys at Zero Turnaround I finally got it to work, and it's well worth the effort. Here is a guide for what you need to do...

  1. Install JRebel, the latest version for your platform.

  2. Get into Eclipse and install the JRebel Eclipse Plugin using the "Install New Software..." link under the Help menu, and add the JRebel Update site...

    http://www.zeroturnaround.com/update-site

    I specified the "JRebel Eclipse Debugger Integration" and "JRebel Eclipse Integration only" components.

  3. Specified the jrebel.jar in Eclipse / JRebel preferences. (Mine was in my C:\Program Files\ZeroTurnaround\JRebel\jrebel.jar folder.

  4. The installation Wizard provided with JRebel provides you a guide to get it working in Eclipse. Make sure you go through those steps. (...adding org.zeroturnaround.* etc in Eclipse preferences)

  5. Modified the dev_appserver.cmd, which on my PC sat in

    C:\dev\eclipse\eclipse-SDK-3.6-win32\plugins\com.google.appengine.eclipse.sdkbundle.1.3.7_1.3.7.v201008311427\appengine-java-sdk-1.3.7\bin\dev_appserver.cmd

    Here is it's contents:

    @java -cp "%~dp0\..\lib\appengine-tools-api.jar" ^
        com.google.appengine.tools.KickStart ^
    --jvm_flag=-javaagent:%REBEL_HOME%\jrebel.jar --jvm_flag=-noverify ^
           com.google.appengine.tools.development.DevAppServerMain %*
    


  6. Now you need to add this to the VM Arguments for your Run configuration for your App Engine application:
    -javaagent:/opt/jrebel/jrebel.jar -noverify
    Again, make sure this points to your jrebel.jar location.

  7. Once you've modified the VM Arguments in the app run config then you should see the JRebel text appear in the console.

  8. By the way, you don't need to execute your application in Debug mode to get JRebel to work. If you modify a file in Debug mode you'll still get the "Hot Code Replace Failed" message.

  9. To test I simply booted up the app, and added a method to a class and called it - You'll see a message in the console saying that JRebel is reloading the class.

Now enjoy a considerably quicker method of developing / deploying App Engine apps. $59 bucks is well worth it!

I'm hoping the team at Zero Turnaround turn their attention to Android's Dalvik VM next. JRebel would be of HUGE benefit to developing Android apps and I'm sure with the amount of Android developers out there at the moment it would be a big money spinner for them too.

6 comments:

Kazik said...

please clarify point 6
Now you need to add this to the VM Arguments for your Run configuration for your App Engine application:

-javaagent:/opt/jrebel/jrebel.jar -noverify

Again, make sure this points to your jrebel.jar location.

- where exactly should it be added? some file?
thanks kazik dot trzonek at gmail dot com

Unknown said...
This comment has been removed by the author.
Eurig Jones said...

The VM arguments in the apps run configuration!

Kazik said...

what do You mean
"apps run configuration"

where is this file, how is it called??

do You mean appcfg.cmd in bin directory (in the same dir as dev_appserver.cmd) ?

Eurig Jones said...

No, the eclipse run configuration for your application. When you click on 'run-as' on your app you get a 'run configurations..' option.

TWiStErRob said...

I started this process, but the whole stuff changed now. As of this date the process is:
1. Install JRebel Eclipse plugin through Help/Eclipse Marketplace
2. Right click project and JRebel/Add JRebel nature
3. Start and accept JRebel agent confirmation