cannot load jars/class

I have class

factory = CreateObject( “java”, “com.intelligt.modbus.jlibmodbus.master.ModbusMasterFactory”, ExpandPath( “.” ) );

cannot load class through its name class could not be found.
So I put jars in ~/.CommandBox/lib/
still wont load.

Works in lucee 5.

Can you add a libdirs property to your server.json file? like this:

app":{
"cfengine":"lucee",
"libDirs":"Drive:\\Path\\To\\folder\\with\\jars"
},

That lib folder is probably for theCFML engine which isdriving commandbox,not for a server you start with commandbox.

Dan

I think Dan’s right, the libDirs property works for me for loading app-specific jars.

Dave

Yes, it’s important to note that a web server you start runs as a totally different Java process with its own classpath and the lib folder in the CommandBox installation for the CLI has nothing to do with the libs loaded into your server. libdirs is the correct way to load up extra jars into the JVM for a server. It’s the equivalent of Tomcat’s lib folder. In many cases though you can just use this.javaSettings in your Application.cfc FWIW.

Thanks!

~Brad