$ ls
Dockerfile Service1.class Service1.java socket.jar tp/
$ java Service1 -jar socket.jar
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: real/connector/view/FunctionHandler
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: real.connector.view.FunctionHandler
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)
... 7 more
I have put everything in place. Still seem to getting this error. Can anyone please suggest
Setting CLASSPATH helped.
I set CLASSPATH as export CLASSPATH=/c/Users/Sufi/docker/socker.jar**:.**
I had missed :. in the end. Now its working good.
Related
I just started with programming Java.
I want to use Eclipse. I already installed latest JRE 8 and JDK. But when I want to run my "Hello World" problem I get the following error:
"Error: A JNI error has occured, please check your installation and try again."
After that a new error window appears:
"A Java Exception has occured."
Beside the console gives me following details:
`Exception in thread "main" java.lang.NoClassDefFoundError: [LString;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: String
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)
... 7 more`
What installation do I have to check? Thank you!
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.
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.
I tried to run Lucene Indexer but it gives me the following error:
java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
... 7 more
Exception in thread "main"
I used compile command:
javac -classpath 'C:/Users/Daniel/desktop/Java WorkSpace/JavaPackage/lucene-3.0.0/lucene-core-3.0.0.jar' Indexer.java;
and it works.
But when I tried to execute the compiled class:
java Indexer;
It gives me the ClassNotFoundException(). PS: the compiled class file and jar file are not in the same folder. Would that matter?
Thanks!
The Lucene Analyzers are no longer in the Lucene core. Download the JAR (or add to your Maven dependencies) for the corresponding version here: http://mvnrepository.com/artifact/org.apache.lucene/lucene-analyzers
I am making a webapp using tomcat but its having problems in running in windows...there is a java file(thread.java) which runs another java file(emaildownload.java) so first I need to get to the directory in which class file is stored ...I am using
this.getClass().getClassLoader().getResource("").getPath();
for getting class path...and then I am running file by:
thread foo=new thread();
foo.runProcess("java mainclasses.emaildownload "+credentials[0]+" "+credentials[1]+" "+credentials[2]+" "+credentials[3]+" ");
file structure:
C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\Mazil3.0\WEB-INF\classes\mainclasses\emaildownload.class
and mainclasses is package...
but I am getting this error:
java.lang.NoClassDefFoundError: javax/mail/UIDFolder
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.mail.UIDFolder
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
... 6 more
I don't understand why the error is coming?
Interface UIDFolder belongs to javax.mail package since it is saying NoClassDefFoundError so you might not be having the javamail api in your classpath .Get it from here
I have a batch file which runs on XP:
#echo off
#setlocal
set CWD=%~dp0
set JYTHON_HOME=%CWD%
set LIB_DIR=%JYTHON_HOME%/lib
java -cp %LIB_DIR% -jar %LIB_DIR%/jython.jar -Djython.home=%CWD%
-Dpython.path=%LIB_DIR%;%CWD%/ext %LIB_DIR%clenotes/clenotes.py %*
#endlocal
I want to run this file on Windows 7.
EDIT:
When I run it this error occurs:
Exception in thread "main" java.lang.NoClassDefFoundError:
folder\CLENotes\lib Caused by: java.lang.ClassNotFoundException:
folder\CLENotes\lib
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Actually it is very simple, I needed to change the fowardslashes (/) to backslashes.