我想使用MTJ库。但是为什么我会得到一个ClassNotFoundException呢?我如何以正确的方式实现我的构建和编码?
首先是错误消息,然后是代码示例:
错误(gradle build;java -jar build/libs/tmp.jar):
Exception in thread "main" java.lang.NoClassDefFoundError: no/uib /cipr/matrix/DenseMatrix
at de.piphi.Main.readMatrix(Main.java:7)
at de.piphi.Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.DenseMatrix
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)gradle.build:
apply plugin: 'java'
repositories{
jcenter()
mavenCentral()
}
dependencies {
compile group: 'com.googlecode.matrix-toolkits-java', name: 'mtj', version: '1.0.2'
}
jar {
manifest {
attributes 'Main-Class': 'de.piphi.Main'
}
}src/main/java/de/piphi/Main.cpp:
package de.piphi;
import no.uib.cipr.matrix.*;
public class Main {
static void readMatrix(){
Matrix m = new DenseMatrix(2,2);
System.out.println(m);
}
public static void main(String[] args) {
readMatrix();
}
}我知道Is there any example how to use Matrix Toolkit Java (MTJ)?,但是the wiki page mentioned已经不存在了。
https://stackoverflow.com/questions/47578531
复制相似问题