Skip to main content

Reloading class using spring-loaded Jar

As a  java developer using eclipse, every time, when we made the change on the class, annotation or the xml files, eclipse will pop up a message let us decide ‘continue, restart  tomcat and more’. I am kind of appreciate its kindness. However,  most of the time, I have to select ‘restart’. So, I just wish eclipse  or tomcat can help to reload class files and don’t bother me that option.

Before, I found jRebel which is perfect for my wishing. It is just hard to push management team pay for that  $365 per license annually.

So, I need to cater myself and the one I can afford which is $0 a year, and it’s using Apache License.

How to config?

#2 in your eclipse, adding below arguments in the VM arguments. You need to amend the path to the jar file in your machine.

-Djavaagent:C:/Dev/lib/springloaded-1.1.2.20130430.jar –noverify

#3 Ready to go

Comments

  1. in my case it worked as:
    -javaagent:/path_to_jar/springloaded.jar -noverify

    ReplyDelete
  2. Thanks. Yours are more generic :)

    ReplyDelete
  3. On a Windows Service tomcat installation I found that I had to use

    -Xverify:none
    -javaagent:"C:\path_to_jar\springloaded-1.2.1.RELEASE.jar"

    notice I used -Xverify:none instead of -noverify, otherwise it woudn't recognize the command, spent hours troubleshooting because of that little detail.

    I find that it works great for changing method bodies or constructors, but it doesn't actually let me add new methods or fields, they don't get recognized until I restart the app, which is a bummer, and it's strange because their documentation says otherwise.

    Does anybody have the same problem? JVM has java 7 but the project's source level is set to java 6

    ReplyDelete
  4. is it work on tomcat jee

    ReplyDelete
  5. The hephen before noverify is not formatted properly for copying and pasting over but it works after I replaced it (with correct mapping of course).

    ReplyDelete

Post a Comment