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.
Related
$ 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.
I am trying to run a groovy project in windows java rembrandt.bin.Rembrandt and i got the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/r
untime/BytecodeInterface8
at rembrandt.bin.Rembrandt.<init>(Rembrandt.groovy)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstru
ctor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteN
oUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstru
ctor(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor
(AbstractCallSite.java:190)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor
(AbstractCallSite.java:198)
at rembrandt.bin.Rembrandt.main(Rembrandt.groovy:383)
Caused by: java.lang.ClassNotFoundException: org.codehaus.groovy.runtime.Bytecod
eInterface8
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)
... 11 more
I am using java 8. the funny thing is that i tried to run in Linux and the program worked.In Linux i am running java 7, but already tried with java 7 in windows and nothing. I am using groovy 1.7.5 and this class( BytecodeInterface8) only appear in 1.8.0 i cant understand why this run fine in Linux and not in windows. Ty for your help
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 want to execute a Java class from a bat file and it include usage of opencsv.jar.
Below is the code:
#echo off
set path=%PATH%;C:\Program Files (x86)\Java\jdk1.6.0\bin
javac -cp opencsv.jar ArbitrageUsingThread.java
java ArbitrageUsingThread
I am getting the following error when running it. I think there is some problem with including opencsv.jar Can anyone help me with this?
Error
Exception in thread "main" java.lang.NoClassDefFoundError: au/com/bytecode/openc
sv/CSVWriter
at ArbitrageUsingThread.main(ArbitrageUsingThread.java:67)
Caused by: java.lang.ClassNotFoundException: au.com.bytecode.opencsv.CSVWriter
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)
... 1 more
java is similar to javac for classpath.
Under linux:
java -cp opencsv.jar:. ArbitrageUsingThread
Under windows:
java -cp opencsv.jar;. ArbitrageUsingThread
I just installed JGNAT on Windows (gnat-gpl-2010-jvm-bin.exe)
This is a sample code hello.adb from the included manual:
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line ("Hello GNAT for the JVM.");
end Hello;
First, compile it: jvm-gnatmake hello.adb
jvm-gnatcompile -c hello.adb
jvm-gnatbind -x hello.ali
jvm-gnatlink hello.ali
Looks fine. So let's run it: java hello
Exception in thread "main" java.lang.NoClassDefFoundError: jgnat/adalib/GNAT_libc
at hello.main(hello.adb)
Caused by: java.lang.ClassNotFoundException: jgnat.adalib.GNAT_libc
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)
... 1 more
Any idea why?
Here's the fix. You must set the classpath to the jar file containing GNAT_libc.class.
java -cp C:\GNATPRO\2010\lib\jgnat.jar;. hello