我已经写了一个使用opengl的程序,我已经在eclipse中没有问题的情况下运行了,现在我想把它打包成一个jar来部署。从罐子里运行opengl jogamp
我正在使用maven来管理所有的依赖和构建过程。我已经做了一个清理和打包来构建一个具有所有必要依赖项的jar,但是我很难让它实际运行。
它似乎在寻找jar文件以外的文件,例如gluegen-rt.dll,我可以看到它位于顶层jar文件中。它似乎也正在尝试引用我的jar版本,并在名称后面加上'-natives-windows-amd64'。
当我尝试运行它,我得到以下错误:
D:\My Documents\workspace\Cube\target>java -jar cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar 10 OPENGL
Catched FileNotFoundException: D:\My Documents\workspace\Cube\target\cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar (The system cannot find the file specified), while addNativeJarLibsImpl(classFromJavaJar class com.jogamp.common.os.Platform, classJarURI jar:file:/D:/My%20Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/com/jogamp/common/os/Platform.class, nativeJarBaseName
cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar): [ file:/D:/My%20Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies.jar -> file:/D:/My%20Documents/workspace/Cube/target/ ] + cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar -> slim: jar:file:/D:/My%2520Documents/workspace/Cube/target/cube-0.0.1-SNAPSHOT-jar-with-dependencies-natives-windows-amd64.jar!/
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: D:\My Documents\workspace\Cube\target\gluegen-rt.dll
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:551)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:96)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:414)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:388)
at com.jogamp.common.os.Platform$1.run(Platform.java:209)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:179)
at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:83)
at ui.jogl.JOGLCube.init(JOGLCube.java:52)
at ui.jogl.JOGLCube.<init>(JOGLCube.java:44)
at ui.jogl.JOGLCubeController.<init>(JOGLCubeController.java:19)
at core.Cube.getVirtualCube(Cube.java:37)
at core.Cube.<init>(Cube.java:27)
at core.Cube.main(Cube.java:56)
我与OpenGL的工作没有现成的经验,因此任何帮助,将不胜感激。
感谢您的阅读
我们的方法并不疯狂,SWT和LibGDX做类似的事情,它是可选的,它可以被禁用。当它仍然启用时,如果目录出现问题,可能是由于最近修复了一个问题,导致GlueGen无法在某些特定情况下在Windows下创建临时目录。否则,请随时提出改进请求以允许开发人员通过自定义目录来存储本地库,这将比您的建议容易得多。 – gouessej 2014-09-07 11:30:52