jsoup - Failing to start java program ClassNotFound exception received -
trying start java program on linux fails locate jsoup jar file. have checked other questions , found on how add libraries while compiling , while trying run not sure if doing correctly because still fails load library....
i enter following commands:
root@vps5441:/var/www/var/www/timetableloader# javac -cp /var/www/var/www/timetableloader/jsoup-1.8.1.jar:/var/www/var/www/timetableloader/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar. timetableloader.java root@vps5441:/var/www/var/www/timetableloader# java -cp /var/www/var/www/timetableloader/jsoup-1.8.1.jar:/var/www/var/www/timetableloader/mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar. -classpath /var/www/var/www/timetableloader/ timetableloader
and following error when program tries access jsoup library.
exception in thread "main" java.lang.noclassdeffounderror: org/jsoup/jsoup @ timetableloader.main(timetableloader.java:46) caused by: java.lang.classnotfoundexception: org.jsoup.jsoup @ java.net.urlclassloader$1.run(urlclassloader.java:366) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:308) @ java.lang.classloader.loadclass(classloader.java:358) ... 1 more
i assume jsoup-1.8.1.jar in current directory?
you don't need both -classpath
, -cp
. it's ignoring values given -cp
result.
put own classes ahead of 3rd-party ones.
you're in /var/www/var/www/timetableloader keep simple:-
root@vps5441:/var/www/var/www/timetableloader# java -cp .:jsoup-1.8.1.jar:mysql-connector-java-5.0.8/mysql-connector-java-5.0.8-bin.jar timetableloader
(best out of habit of running things "root" unless have genuine need, sayin')
Comments
Post a Comment