
Drebel.properties="/absolute_path_to_your_home_folder/.jrebel/jrebel.properties"Īgain, remember to specify absolute paths. ="/absolute_path_to_your_home_folder/.jrebel/jrebel.log" javaagent:"/absolute_path_to_jrebel_installation/jrebel/jrebel.jar"
In the simplest case you have to add the -javaagent parameter either to your launch script or to the server start script: java Next thing is the JVM launch configuration.
The web/link element is for the web resources that you would like to have reloaded, i.e.: JSPs, image files, CSS files, JavaScript files, etc. Then JRebel will find out that the class is changed and reload it.
#Jrebel standalone code#
If you use Eclipse and have ticked the option Project/Build Automatically, after you save the source file Eclipse will automatically compile your code and overwrite the class file. The classpath element is used for the path to your compiled classes. You should put absolute paths, not relative ones, as the working directory from which JRebel will run may be hard to specify. Here is an example of the rebel.xml file:
run your application or start your server with the -javaagent parameter specifying the path to the jar with JRebel. place rebel.xml in the main folder of the package (jar/ear/war, etc.) that will be run as a standalone application or will be deployed to server. Then at the bytecode level it adds/removes/replaces fields/method bodies/etc. If you compile a class, JRebel notices the change and compares the differences between class definitions. It looks for changes in the folder with your compiled classes. It works as a java agent on top of the JVM. JRebel instantly reloads changes to Java code. I think JRebel is cool, but as everything it is not perfect, so before buying it you should learn how it works. I tried to be honest and not to force any opinions. All the information is based on my personal experience after using JRebel for the last 10 months. You can read more about the rebel.Disclaimer: I wasn't paid for this post. When you however add the build dir to the classpath and run the class, then JRebel should reload the classes without needing the rebel.xml file. To see the reloads you'd need to generate the rebel.xml file and build it into the jar. You can check if that's also the case with your application by running the app in command line.įirst run the Spring Boot jar file with JRebel and without a rebel.xml file and you'll see the reloads won't happen. The same thing sometimes also happens with an exploded web application started from an IDE. Such a setup doesn't need the rebel.xml file. In that case the classes being run are already in the build folder so they are reloadable and also the changes happen in a directory that is monitored by JRebel. However in many cases when running a standalone application inside an IDE, then the IDE doesn't run the jar file, but instead directly runs the classes from the build directory and adds the build directory to the classpath. To add the directories in the rebel.xml to classpath so JRebel would monitor them. To make JVM load the classes from the build directory. So if starting a jar file with JRebel and without a rebel.xml file then it wouldn't have any directories to monitor and wouldn't be able to reload anything. Regardless of the rebel.xml file, JRebel monitors all directories it can find in the classpath.
JRebel uses the rebel.xml file in order to remap your classpath resources and servlet resources to your build directory so that when you make a change in the IDE and build the class, then JRebel will detect the change in that build directory and reload the changed class.