Hi guys,
I wrote code for myself, as suddenly something strange happened, I got the NoClassDefFound-Error, because the name of a class is false. Here ist the code snippet and the error message from the command line:
This code is int the file "Test.java" and if I execute it with javac and
java I get this error from the command line:
C:\Users\Kamil\Desktop>javac Test.java
C:\Users\Kamil\Desktop>java Test
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: test (wrong name: Tes
t)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
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)
C:\Users\Kamil\Desktop>
But if I change only the identifier of the used interface from test to est for example, the code fully compiles and execute:
C:\Users\Kamil\Desktop>javac Test.java
C:\Users\Kamil\Desktop>java Test
Class1
Class2
C:\Users\Kamil\Desktop>
So why this error is comming up, when Java is case-sensitive?
My guess is, that in the JLS is a bottom line and I do not know anything of it, so I would be happy if someone could explain my the previusly mentioned behavior.
Thank you for your help,
Kamil