我正在使用maven打包我的Java项目并将其作为jar运行。在Eclipse中一切正常。
我使用maven-assembly-plugin
以便在jar中也具有依赖项。
但是,我仍然收到以下JNI错误:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/semanticweb/owl/align/AlignmentException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.semanticweb.owl.align.AlignmentException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
POM:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<finalName>jarName</finalName>
<archive>
<manifest>
<mainClass>package.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
我也尝试将maven-dependency-plugin
与maven-jar-plugin
一起使用,例如here,但结果相同。
感谢您的帮助。
编辑:我确实有一些系统范围的依赖项。