Lucee 7.1 missing classpath

Hi, we’ve been using Lucee for quite some time now—currently still version 6.2—in a Windows Server environment and for testing/development purposes on Windows 11.
I’ve now tentatively upgraded the environment to version 7.1 (fresh installation in a new directory). The application works more or less as expected, but when I try to access my own classes (*.class files in a directory as well as *.jar libraries), I get messages saying that the classes cannot be found.
I copied the classpath using Luceew.exe (Java tab). When I display the classpath with getClassPath, my change isn’t reflected—only the Tomcat path is visible.
Does anyone have any ideas on how I can integrate my classpath into Tomcat?
Thanks, best regards, Kalle

Hi Kalle, welcome to the Lucee forum, good to have you here.

The Java tab in Luceew.exe sets Tomcat’s JVM classpath for the Windows service. By default that is only Tomcat’s bootstrap jars (bootstrap.jar and tomcat-juli.jar). getClassPath() reports that JVM classpath, which is why you mainly see the Tomcat path.

In Lucee 7, though, that is no longer the place to add your own jars and classes. Lucee loads application libraries through its own settings, not through the Tomcat service classpath. These are the recommended approaches:

For your application, set this.javaSettings in Application.cfc. You can point at local jars, directories of jars, or directories of .class files, and you can also pull libraries from Maven:

this.javaSettings = {
    loadPaths = [
        "C:\path\to\libs\",
        "C:\path\to\classes\"
    ]
};

See JavaSettings in Application.cfc and, if useful, Loading Java Libraries with Maven.

For the whole server, copy your .jar files into lucee-server/context/lib under your 7.1 install and restart Lucee. Lucee picks those jars up automatically.

For a single class, you can still pass a path to createObject():

obj = createObject("java", "com.example.MyClass", "C:\path\to\libs\");

If a class is still missing after one of those, let us know how you create the object and where the jars and class files live, and we’ll take another look.

Best,
Gian

Hi, thanks, Gian, for your reply. I wasn’t familiar with javasettings yet. As a test, I had used an array with the classpath in createObject.

I’ve found the root cause. Since I wanted to test version 7, I have two environments on the machine. It’s possible that I reconfigured the services using service.bat and then mixed up the names during installation compared to the first installation. There were two entries in the registry.

I uninstalled version 7, deleted the version 6 service, and then reinstalled it. Right now, it’s finding my classes.

Best, Kalle