1

I have made many attempts to enter a command to run a JAR file correctly from the terminal, and I am 100% sure that all the JAR files and such are in the given paths, but I keep getting a ClassDefNotFoundException. Does it have anything to do with the way that I am entering the command?

C:\Users\ANNA\Downloads>"C:\Program Files\Java\jre1.8.0_45\bin\java.exe" -Djava.library.path="C:\Users\ANNA\Downloads\Windows64_Libjitsi\lib\native\windows-64" -cp "C:\Users\ANNA\Downloads\SimplifiedConnectionProvider.jar;C:\Users\ANNA\Downloads\Windows64_Libjitsi" Core.PublicService Exception in thread "main" java.lang.NoClassDefFoundError: org/jitsi/service/lib jitsi/LibJitsi at Core.PublicService.<clinit>(PublicService.java:38) Caused by: java.lang.ClassNotFoundException: org.jitsi.service.libjitsi.LibJitsi 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) ... 1 more 

Didn't work. Tried again:

C:\Users\ANNA\Downloads>"C:\Program Files\Java\jre1.8.0_45\bin\java.exe" -Djava. library.path="C:\Users\ANNA\Downloads\Windows64_Libjitsi\lib\native\windows-64" -cp C:\Users\ANNA\Downloads\SimplifiedConnectionProvider.jar;C:\Users\ANNA\Downl oads\Windows64_Libjitsi Core.PublicService Exception in thread "main" java.lang.NoClassDefFoundError: org/jitsi/service/lib jitsi/LibJitsi at Core.PublicService.<clinit>(PublicService.java:38) Caused by: java.lang.ClassNotFoundException: org.jitsi.service.libjitsi.LibJitsi 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) ... 1 more 

Didn't work. Tried again:

C:\Users\ANNA\Downloads>"C:\Program Files\Java\jre1.8.0_45\bin\java.exe" -Djava. library.path=C:\Users\ANNA\Downloads\Windows64_Libjitsi\lib\native\windows-64 -c p C:\Users\ANNA\Downloads\SimplifiedConnectionProvider.jar;C:\Users\ANNA\Downloa ds\Windows64_Libjitsi Core.PublicService Exception in thread "main" java.lang.NoClassDefFoundError: org/jitsi/service/lib jitsi/LibJitsi at Core.PublicService.<clinit>(PublicService.java:38) Caused by: java.lang.ClassNotFoundException: org.jitsi.service.libjitsi.LibJitsi 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) ... 1 more 

Note that the class "org.jitsi.service.libjitsi.LibJitsi" really is in a JAR file whose real location is in the folder "C:\Users\Anna\Downloads\Windows64_Libjitsi", which is the class path for JAR files that I am attempting to specify on the command line.

1 Answer 1

1

You have add the JAR to the CLASSPATH, not the folder which contains this JAR. So the -cp argument should something be like this C:\Users\ANNA\Downloads\SimplifiedConnectionProvider.jar;C:\Users\ANNA\Downloads\Windows64_Libjitsi\the_name_of_the_JAR.jar.

Sign up to request clarification or add additional context in comments.

3 Comments

What if I want all the jar files in a folder?
I want ALL the jar files in folder "C:\Users\ANNA\Downloads\Windows64_Libjitsi" but only one jar file whose name is "C:\Users\ANNA\Downloads\SimplifiedConnectionProvider.jar"
Nevermind, * is wildcard: stackoverflow.com/questions/219585/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.