Java File runs in eclipse but on command line -


i have created jar file in eclipse using maven , able run class jar file eclipse. when run following command command prompt:

c:\recomendation_engine\recomendation\target>java -classpath recomendation-0.0.1 -snapshot.jar recomendation.managegeneralcontent test 

i following error:

organization environment test java.lang.classnotfoundexception: com.mysql.jdbc.driver         @ java.net.urlclassloader$1.run(unknown source)         @ java.net.urlclassloader$1.run(unknown source)         @ java.security.accesscontroller.doprivileged(native method)         @ java.net.urlclassloader.findclass(unknown source)         @ java.lang.classloader.loadclass(unknown source)         @ sun.misc.launcher$appclassloader.loadclass(unknown source)         @ java.lang.classloader.loadclass(unknown source)         @ java.lang.class.forname0(native method)         @ java.lang.class.forname(unknown source)         @ recomendation.managegeneralcontent.main(managegeneralcontent.java:52) 

i believe issue class can not find mysql driver. in classpath:

c:\program files\java\jdk1.7.0_60\lib\*;c:\users\user\.m2\repository\com\google\ guava\guava\18.0-rc1\guava-18.0-rc1.jar;c:\users\user\.m2\repository\org\slf4j\s lf4j-api\1.7.7\slf4j-api-1.7.7.jar;c:\users\user\.m2\repository\com\jolbox\bonec p\0.8.0.release\bonecp-0.8.0.release.jar;c:\users\user\.m2\repository\postgresql \postgresql\9.1-901-1.jdbc4\postgresql-9.1-901-1.jdbc4.jar;c:\recomendation_engi ne\recomendation\lib\mysql-connector-java-5.1.6.jar;c:\recomendation_engine\reco mendation\target\recomendation-0.0.1-snapshot.jar; 

can please tell me doing wrong?

you overriding classpath environment variable when specify "-classpath" switch on java command line.

try running:

c:\recomendation_engine\recomendation\target>java      recomendation.managegeneralcontent test 

check out: http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -