My question is about including jar files in the path. It has 2 parts.
1) I am trying to execute the java file of the weka.jar file located in /home/andy/software/weka/weka.jar
The PATH variable points to this jar file (i.e. /home/andy/software/weka/weka.jar), and CLASSPATH.
However, when I try to start the jar using java -jar weka.jar, I get the error "Could not access jarfile weka.jar".
Any ideas what is going on? I am on Ubuntu Linux. I looked around and it seems that I am not doing anything that is clearly wrong (since both PATH and CLASSPATH seem to be set correctly).
2) I would like to be able to put all my jar files in one directory and include this directory in my path (instead of including each jar separately). How can i do this?
Thanks in advance.
EDIT 1 -> Here is my command line
andy@laptop :~$ export CLASSPATH=$CLASSPATH:/home/andy/research/software/weka/weka.jar andy@laptop :~$ echo $CLASSPATH :/home/andy/research/software/weka/weka.jar andy@laptop :~$ java -jar weka.jar Unable to access jarfile weka.jar andy@laptop :~$ java weka.jar Exception in thread "main" java.lang.NoClassDefFoundError: weka/jar Caused by: java.lang.ClassNotFoundException: weka.jar at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) Could not find the main class: weka.jar. Program will exit. andy@laptop :~$
EDIT 2 -> I changed the PATH variable to point to the directory '/ home / andy / research / software / weka /' and still βcannot access the jarfile errorβ
source share