I've got a .class file in my local directory, assembled from following jasmin code:
.class public default_class
.super java/lang/Object
.method public static main([Ljava/lang/String;)V
.limit locals 10
.limit stack 10
invokestatic main_65428301()I
return
.end method
.method public static main_65428301()I
.limit locals 10
.limit stack 10
ldc "foobar"
astore_0
iconst_0
ireturn
.end method
when I do java -jar jasmin.jar test.j everything compiles and I get .class file, but I'm not able to start it with java default_class, because I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError:
at default_class.main(test.j)
Caused by: java.lang.ClassNotFoundException:
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 1 more
My JAVA_HOME is:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
and classpath contains only my current directory (where this .class file is located). Should I add something to it?
EDIT:
command I use to launch my class is java default_class
EDIT2: OK, finally I have figured out what was wrong! The name of the class has to start with uppercase! This solved my problem! Anyway, thanks to all of you who attempted to help me!