我正在尝试使用maven配置JOGL,请参考这里的指南:http://jogamp.org/wiki/index.php/Maven
据我所知,应该足以包含这些依赖关系:
<dependencies>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>因为他们说:
"So, when you add a dependency on jogl-all-main in your own project, the native jar files of jogl-all are brought in as transitive dependencies and everything works as expected."我已经创建了一个包含这些依赖项的Maven项目,现在该项目如下所示:

我编写了一个简单的HelloWorld类来测试它:
import com.jogamp.opengl.GLCapabilities;
public class HelloWorld {
public static void main (String args[]) {
try {
System.loadLibrary("jogl");
System.out.println("Hello World! (The native libraries are installed.)");
GLCapabilities caps = new GLCapabilities(null);
System.out.println("Hello JOGL! (The jar appears to be available.)");
} catch (Exception e) {
System.out.println(e);
}
}
}但是运行它时,我得到了这个错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
at java.lang.Runtime.loadLibrary0(Runtime.java:849)
at java.lang.System.loadLibrary(System.java:1088)
at jogl.HelloWorld.main(HelloWorld.java:12)所以似乎没有找到本机dll (我在windows上)。
这里出了什么问题?是教程错了,还是我漏掉了什么?
这是我使用的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jogl</groupId>
<artifactId>jogl</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</project>https://stackoverflow.com/questions/47672200
复制相似问题