Search code examples
coldfusionrailolucee

Easily deploying .jar files without restarting the service


I am wondering if there is an easy way of deploying a .jar easily without restarting the service? I found a couple different posts but they are a little bit old and they mention using a library called JavaLoader Programmatic reloading of Java JARs without restarting ColdFusion Is there an alternative to doing this? I am developing with a java sdk and it is very time consuming to keep restarting after every change and I would prefer not to use a library just to accomplish this.

Edit: I am using Lucee 5.2


Solution

  • For Lucee, Javaloader is the way to go. https://github.com/markmandel/JavaLoader. The library might be a little old, but so is ColdFusion. Javaloader has never been replaced because it works really well and a replacement isn't needed. The developer, Mark Mandel, is a very smart guy who works for Google now. You can see what he's up to at https://twitter.com/Neurotic.

    Javaloader is easy to use once you understand how to configure it. It accepts an array of paths to your Java libraries. Once it is configured, use javaloader.create() to call your classes:

    jars = [ expandPath( "/classes/mypackage.jar" ) ];
    javaloader = createObject("component", "javaloader.JavaLoader").init( sourceDirectories = jars );
    myclass = javaloader.create( "myclass" ).init();