I would like to use the MTJ library. But why do I get a ClassNotFoundException? How can I implement my build and code the right way?
First the error message, then the code example:
Error (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();
}
}
I know Is there any example how to use Matrix Toolkit Java (MTJ)?, but the wiki page mentioned does not exist anymore.