We have an application developed in NetBeans, based on the NetBeans platform. There’s a 3’rd party program that we have a runtime dependency on, more specifically a jar in the other progams lib folder.
How should we include the other progam’s jar in our classpath?
The recommendation from the other progam’s manufacturer is to set environment variable CLASSPATH to include
C:\Progam Files\Other Program\lib\theJAR.jar
And if that’s not possible, we should copy theJAR.jar to JRE-HOME\lib\ext
We must not copy theJAR.jar anywhere else, that might cause it to stop working…
Now NetBeans takes no notice of what’s on environment variable CLASSPATH. Their recommended way seems to be to make a wrapper, but that would lead to copying the jar, unless there’s some way to make a wrapper module that points to CLASSPATH?
At the moment we are copying the jar into JRE-HOME\lib\ext. But then there’s unnecessary hassle when we install some java update.
Do you have any solution to this problem? It seems like something that might be simple, but I haven’t found the right place to look yet…
Edit: The application is ant-based.
From the documentation for the Module System API’s overview of the runtime infrastructure (bottom of the page under the section "Common Problems and Solutions"):
It goes on to list two more options. The second option is the same solution you’ve come up with. The third is to "partition your module and use a new classloader" which I can’t recommend either way since I have no experience doing this (but it’s worth a read).
Assuming that this first option is what you are looking for, you will need to add a custom .conf file to your project and point to it in your project.properties file, like so:
app.conf=nbproject/my.conf. This will add your custom .conf file to your app’s install directory instead of the default config file that is normally added. Of course, you’ll need to add the-cp:a c:\eak\lib\eak.jarentry to this custom config file in order to load the .jar.During development you’ll need to add the following entry to the project.properties file:
run.args.extra=-cp:a c:\eak\lib\eak.jar. This will pass the command line option to your debug instance.