Skip to main content
10-Marble
February 11, 2010
Question

External Class useful testing tip

  • February 11, 2010
  • 3 replies
  • 970 views

So awhile back I had posted if there was any way to not bounce the server each time I made a change to a class and wanted to test the changes.

The answer I got back was no, you need to restart the MethodServer.

So what I've been doing to get around this is:

  1. Create a JSP file to do my testing with.
  2. Copy my methods into the JSP.
  3. Make the modifications to the methods
  4. Open the JSP with the web browser.
  5. If necessary make additional changes to the methods in the JSP page
  6. Refresh the web browser etc...
  7. Once I'm satisfied with the changes i've made, copy the modified methods from the JSP back into my external classes, and recompile

Of course all the editing i'm doing is on my local machine and I then transfer it to my development server. I omitted those steps above.

3 replies

1-Visitor
February 11, 2010
you just have to make sure you have reload = true and development = true in
the tomcat settings or you will have to bounce tomcat each time you update

1-Visitor
February 11, 2010
I use Groovy Console to test any api quickly. No compilation required.

Regards,
Prathap




12-Amethyst
February 12, 2010
Or you can use the feature in Java debuggers that allows you to hot-swap
in a new version of a class.

Unfortunately this feature has limitations, e.g. you can't hotswap in a
new version of the class if you add new methods or fields, so it's
utility is more limited than that of the JSP trick (which works by using
a separate classloader for the JSP's class) but this can be quite nice
in any JVM if you're just tinkering with the internals of existing methods.