I am trying to run a Java application, but getting this error:
java.lang.ClassNotFoundException:
After the colon comes the location of the cla
Add the full path of jar file to the CLASSPATH.
In linux use: export CLASSPATH=".:/full/path/to/file.jar:$CLASSPATH"
. Other way worked (without editing the CLASSPATH) was unzipping the jar in the current project folder.
Ways didn't work for me:
1) Using -cp
option with full path of jar file.
2) Using -cp
with only the name of jar when located in the current folder
3) Copying the jar to the current project folder
4) Copying the jar to standard location of java jars (/usr/share/java)
This solution is reported for class com.mysql.jdbc.Driver in mysql-connector-java.5-*.jar, working on linux with OpenJDK version 1.7