I made a Java class using JAI. The class was working fine in Netbeans. Now I have to add cmd.exe and javac.
However, now the class is not working, whatever I've tried from the JAI library. Here is where I use JAI on my class.
import javax.media.jai.JAI;
import javax.media.jai.RenderedImageAdapter;
...
RenderedImage rendimg=JAI.create("fileload","/Users/Blob/Desktop/projet_jni/ressources/init.pgm");
BufferedImage init = new RenderedImageAdapter(rendimg).getAsBufferedImage();
I tried to install JAI with the jai-1_1_3-lib-windows-i586-jdk.exe. I tried to use jai-1_1_3-lib-windows-i586.jar like that (in the cmd) :
javac -cp ../ressources/ressources.jar;../ressources/jai_windows-i586.jar *.java
It compiles normally, but I always get the error :
C:\Users\USER\Desktop\projet_jni\part_java>java Main
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/jai/JAI
at ImgProcessing.<init>(ImgProcessing.java:46)
at Fenetre.<init>(Fenetre.java:23)
at Main.main(Main.java:25)
Caused by: java.lang.ClassNotFoundException: javax.media.jai.JAI
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
... 3 more
How can I repair this issue?
EDIT :
tried for the same error :
java -classpath "../ressources/ressources.jar;../ressources/jai_windows-i586.jar;." Main
tried :
java -cp ../ressources/ressources.jar;../ressources/jai_windows-i586.jar Main
"Main" can't be found or loaded.
You need the same class path when running your application, as when you compiled it.
I.e.:
java -cp .;../ressources/ressources.jar;../ressources/jai_windows-i586.jar Main