Archive

Posts Tagged ‘jrebel’

Maven-based NetBeans platform development with JRebel 6 – minor update

Some months ago I wrote about how easy it is to use JRebel for development of NetBeans platform module [1]. That article was focused mainly on standard ant-based modules. But recently I started to convert my plugins to the maven-based approach. At the same time I started testing JRebel 6 in an EAP. This combination didn’t work as described in one of my previous blog entries [2], but I figured it out and I like to document it using this blog post.

Steps to get maven-based nbms running using JRebel 6

  • enable “compile on save”
  • generate rebel.xml to /src/main using the context menu of jrebel (this way it will be copied to target/classes)
  • alter the properties-section of the pom.xml like this
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <netbeans.run.params.ide/>
            <netbeans.run.params>-J-noverify -J-javaagent:e:/tools/jrebel/jrebel.jar -J-Drebel.log=true ${netbeans.run.params.ide}</netbeans.run.params>
        </properties>
    
  • run the module – JRebel will create a bootstrap file in your temp directory once and will quit the execution
    JRebel: Starting logging to file: C:\Users\markiewb\.jrebel\jrebel.log
    [INFO] JRebel is now building a boot class cache.
    [INFO] This will only happen on this first run, or after manually deleting the rebel boot folder.
    [WARNING] JRebel bootclasspath not specified!
    [WARNING] Make sure to add -Xbootclasspath/p:C:/Users/markiewb/AppData/Local/Temp//rebelboot.jar to jvm arguments
    [WARNING] Otherwise this warning will appear again, and you won't be able to start your application
    [INFO] System will exit now, please restart the application to run with JRebel enabled.
    
  • add the bootclasspath argument with the path from the previous output to netbeans.run.params too (please note the “-J” prefix, that is important) (If NetBeans does not start, try to remove ${netbeans.run.params.ide} from the <netbeans.run.params>-parameter
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <netbeans.run.params.ide/>
            <netbeans.run.params>-J-noverify -J-Xbootclasspath/p:C:\Users\markiewb\AppData\Local\Temp\rebelboot.jar -J-javaagent:e:/tools/jrebel/jrebel.jar -J-Drebel.log=true ${netbeans.run.params.ide}</netbeans.run.params>
        </properties>
    
  • run the module – the application with your module and JRebel should start up
  • make changes to your classes and jrebel will pick them up

Tested with Win7 64bit, Oracle JDK 1.7.0u40, JRebel 6.0.0-M3, NetBeans IDE 7.4

 

Updates:
15/Mar/2014:

  • Tested with Win7 64bit, Oracle JDK 1.7.0u45, JRebel 6.0.0-M6, NetBeans IDE 7.4Patch2
  • Added comment about removing ${netbeans.run.params.ide}

[1] http://benkiew.wordpress.com/2013/05/01/netbeans-platform-development-with-jrebel-even-more-simplified/
[2] http://benkiew.wordpress.com/2011/12/28/netbeans-module-development-with-jrebel/

Categories: Uncategorized Tags: , ,

NetBeans platform development with JRebel even more simplified

01/05/2013 2 comments

Many things in the JRebel universe have changed in the last months. Several new versions of JRebel were released, Zeroturnaround acquired Javeleon [1] and the JRebel-Plugin for NetBeans IDE got better and better.

Especially the support for developing NetBeans platform/RCP applications has been improved. In my posts [2], [3], [4] I showed you how to configure JRebel to reload your changes within NB platform/NB IDE modules. These are mostly obsolete. The whole process has been simplified, the number of manual steps have been reduced. For example: you don’t need to modify any property-file anymore to tell NetBeans to load the JRebel as javaagent.

Please note that the following description only applies to ant-based module development. The maven-based module development still requires some additions to the pom.xml to get JRebel running.

So if you want to use JRebel to “instantly reload” your compiled changes to a fixed- (or locally compiled bleeding-edge-dev-) version of NetBeans IDE (or your own target platform) you have to follow these simple steps:

  1. install the JRebel-NetBeans-Plugin from the plugin portal and register your license, if not already done
  2. open your module (or open a module from the checkout sources of NB IDE)
  3. generate a rebel.xml in the source folder of the module – let the JRebel-plugin do this for you (right click on the project node, then “Generate rebel.xml“)
  4. make sure that the JRebel icon in the toolbar is checked (this is important, because this tells the plugin to add the -javaagent argument to command line of the next run/debug)
  5. run the module (you will see the JRebel headers in the output window, which means JRebel is loaded, and the target platform with your module activated will be opened)
  6. make your changes to the code, compile via F9 (this includes saving – that’s the trick)
  7. go back to the previously started instance of the target platform, repeat your actions and the changes in code are reloaded instantly (Please note that reloads of changes to layer.xml or additions to bundle.properties aren’t supported. In this case you still have to “build” and “run” the module again.)

This makes it much easier (at least for me) and I hope this simplicity will also attract other developers to write plugins or even to contribute to NB IDE development.

Tested with NB7.3/7.4dev, JRebel-NB-Plugin 1.5.1 and JRebel 5.2.2.

[1] http://www.prweb.com/releases/2013/3/prweb10543831.htm
[2] http://wp.me/pIpWO-64
[3] http://wp.me/pIpWO-5M
[4] http://wp.me/pIpWO-4n


Update 2013/10/13: To use JRebel with locally compiled bleeding-edge-dev version of NetBeans IDE you still have to set the tryme.arg.hack property in nbbuild/build.properties as described in [2]

For example: tryme.arg.hack=-J-Dnetbeans.full.hack=true -J-noverify -J-javaagent:c:/Users/markiewb/AppData/Roaming/NetBeans/7.4/jrebel/jrebel.jar -J-Xbootclasspath/p:C:/Users/markiewb/AppData/Local/Temp//rebelboot.jar -J-Drebel.log=true

Tested with JRebel 6.0-M3 and NB7.4


Categories: Uncategorized Tags: ,

JRebel-Plugin 1.3.1 for NetBeans IDE with new configuration UI and remoting

I previously noticed that “JRebel-Plugin 1.3.1 for NetBeans IDE is released. See http://plugins.netbeans.org/plugin/22254/jrebel-netbeans-plugin

Here some screenshots of the new configuration UI.


Update: The new plugin also allows to configure “JRebel Remoting”. See the toolbar icon and the project property page.

Update 2:  Now it is even offical – see http://zeroturnaround.com/jrebel/jrebel-for-netbeans-7-2-plugin-released-now-includes-jrebel-remoting/

Categories: Uncategorized Tags: ,

NetBeans IDE module development with JRebel

This post is mostly obsolete: See http://wp.me/pIpWO-n0 for an updated version.


In my previous post http://wp.me/pIpWO-5M i showed you how to create your own nbm-modules with the help of JRebel. Today i will show you how you can use JRebel to fasten up the development of the NetBeans IDE platform modules.

So if you want to use JRebel to “instantly reload” your compiled changes to a locally compiled bleeding-edge-development-version of NetBeans IDE you have to follow these steps:

  1. checkout the sources
  2. run “ant” to compile the sources and build a NetBeans installation
  3. open a module to be changed from the checkout sources
  4. create or open \nbbuild\user.build.properties
  5. add the line: tryme.args=-J-noverify -J-javaagent:d:/tools/JRebel/jrebel.jar -J-Drebel.log=true (update the path to the correct installation folder)
  6. create or generate a jrebel.xml in the sourcefolder of the module – let the JRebel-plugin do this for you
  7. run the module against the previously compiled version of NetBeans IDE (now called “target-platform“) using the context menu-entry “Run” (you will see the default JRebel headers in the output window, which means JRebel is loaded, and the Target-IDE will be opened)
  8. make your changes to the code, compile via F9
  9. go back to “target-platform“, do your actions again and the changes are reloaded instantly

FYI: The info about the correct location was taken from http://wiki.netbeans.org/DevFaqNetBeansFullHack

Categories: Uncategorized Tags: , , , ,

Fast NetBeans module development with JRebel – with screencast

This post is mostly obsolete: See http://wp.me/pIpWO-n0 for an updated version.


Based on a previous post http://benkiew.wordpress.com/2011/12/28/netbeans-module-development-with-jrebel/ i made a small video screencast to show how to use JRebel to improve your productivity when developing NetBeans modules.


1. Preconditions and setup

  • NetBeans 7.1.2/7.2.x installed (should work also with other version, but only these two were tested)
  • a valid installation of JRebel > 4.5.x (tested with 4.5.x, 4.6, 4.6.2, 5.0.0)
  • a valid license for JRebel – can also be the free social one – has to be configured in the JRebel configuration wizard
  • JRebel Netbeans Plugin 1.2 installed (use the update center) – required for debugging JRebel-instrumented code and generating rebel.xml
  • Change shortcut for “compile” to CTRL-S (Compile includes saving) – the equivalent to eclipse “Build automatically” or NetBeans “Compile on save” (Because “compile on save” is not yet available for module development projects)

2. Step by step

  •  Follow the instructions to generate a sample project @ http://platform.netbeans.org/tutorials/nbm-code-generator.html
  •  Select “Generate rebel.xml” in the context menu of your project, select the root path of your sources
  •  Add the following line to \nbproject\platform.properties (can be found in the Projects-panel named as “NetBeans Platform Config”)
    run.args.extra=-J-noverify -J-javaagent:d:/tools/JRebel/jrebel.jar -J-Drebel.log=true
    These parameters are taken from the offical JRebel documentation http://manuals.zeroturnaround.com/jrebel-reference-manual/server.html#server-4.6.1
  • Run the project -> a new NetBeans instance should be opened
    Note the output of the activated JRebel plugin in the output window of the development:
    JRebel: Starting logging to file: D:\tools\JRebel\jrebel.log
    [2012-05-19 12:05:05] #############################################################
    [2012-05-19 12:05:05]
    [2012-05-19 12:05:05] JRebel 4.6.2 (201205021440)
    [2012-05-19 12:05:05] (c) Copyright ZeroTurnaround OU, Estonia, Tartu.
    [2012-05-19 12:05:05]
    [2012-05-19 12:05:05] Over the last XXX days JRebel prevented
    [2012-05-19 12:05:05] at least XXX redeploys/restarts saving you about X,X hours.
    [2012-05-19 12:05:05]
    [2012-05-19 12:05:05] Over the last XXX days JRebel prevented
    [2012-05-19 12:05:05] at least XXX redeploys/restarts saving you about X,X hours.
    [2012-05-19 12:05:05]
    [2012-05-19 12:05:05] This product is licensed to XXXX
    [2012-05-19 12:05:05] until XXX
    [2012-05-19 12:05:05] #############################################################
  • Ignore the OSGI-exceptions (JRebel does not yet officially supports nbm-development) – UPDATE: this seams to be fixed in JRebel 5.0.0
  • Change the method content, change fields, do some refactoring …
  • CTRL-S for compiling including saving (see setup above)
  • execute the action in the target IDE again -> JRebel will reload the code

Categories: Uncategorized Tags: , , , , ,

Netbeans module development with JRebel

28/12/2011 2 comments

This post is mostly obsolete: See http://wp.me/pIpWO-n0 for an updated version.


In [project]\nbproject\platform.properties add the following line

run.args.extra=-J-noverify -J-javaagent:e:/tools/jrebel/jrebel.jar -J-Drebel.log=true

Note:

  • This requires a proper installation of jrebel in the path e:/tools/jrebel/
  • Do not forget to generate a rebel.xml into the root of your classpath
  • You have to compile the changed java source manually by Menu->Run->Compile file(“Compile-on-save” is not yet available for netbeans modules)
  • There will be some OSGI-exceptions when running/debugging the application, but class reloading works properly.

Tested with NetBeans IDE 7.1 RC2 (Build 201111302200)+7.1, JRebel 4.5.3


Other resources: http://blogs.codehaus.org/people/mkleint/2009/07/maven-netbeans-platform-javare.html

Update: You can also have a look at Javeleon

Update 2: In maven-based nbms you can run modules the following way (JRebel 4, 5)

  • enable “compile on save”
  • generate rebel.xml to /src/main using the context menu of jrebel (this way it will be copied to target/classes)
  • alter the properties-section of the pom.xml like this
        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <netbeans.run.params.ide/>
            <netbeans.run.params>-J-noverify -J-javaagent:e:/tools/jrebel/jrebel.jar -J-Drebel.log=true ${netbeans.run.params.ide}</netbeans.run.params>
        </properties>
    
  • run the module the normal way – you will accounter some osgi-exception as mentioned above
  • make changes to your classes and jrebel will pick it up like [207230] JRebel: Reloading class 'b2s.compare.clipboard.TextDiffer'.
  • small issue: the jrebel-messages do not appear on the output-window – but in jrebel.log

Update 3:
@mkleint also blogged about JRebel and NBM-development at http://wiki.netbeans.org/DevFaqMavenPlatformRebel

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: