Exporting Java with VM arguments (or alternative)
I'm looking for a way to export a JOGL program that I wrote. Currently, I am referencing four JAR files with a user library, and I specify -Djava.library.path=/lib
as a VM argument. The /lib
folder contains some Mac OS X .jnilib
files that JOGL needs to work.
Everything runs well in Eclipse, but I need a way to export this setup to an executable JAR file. When I export it though, it only exports the JOGL.jars
and not the .jnilibs
.
How can I reference the .jnilibs
so that the exported JAR file can use them?
I spent four or five hours doing the tutorial Creating native binary executables for mu开发者_JS百科lti-platform Java applications with OpenGL and Eclipse RCP which worked, but it's unnecessarily bloated for something that is supposed to be a small application.
I don't think native libraries can be included in a JAR, they need to be available to the native OS to load and execute them. If they're in a JAR, the OS doesn't know what to do with that.
Here is one hackish way that might work.
Also see this SO post for other ideas.
I use a program called JarSplice to store native files inside the JAR.
精彩评论