Java cannot find the class file, while javap can -


i have compiled class (called test.class) using java asm library. decided try , ensure had compiled class attempting run using "java" command.

however, when did this, got "could not find or load main class test" messsage. thought strange, since class inside current working directory (i had tried passing "." classpath, no avail). tried dissassemblng "javap", worked perfectly, strange since if javap can find class file, surely java should able to?

here command line input , output:

$ javap -c test

compiled "test.ash"  public class test {      public test();     code:      0: aload_0      1: invokespecial #9 // method "java.lang.object"."<init>":()v      4: return    public static void main(java.lang.string[]);     code:      0: return } 

$ java test

error: not find or load main class test

$ java test.class

error: not find or load main class test

$ java -cp . test

error: not find or load main class test

$ java -cp . test.class

error: not find or load main class test

what going wrong? compiling class incorrectly, surely javap complain java , javap output looks correct.

i found problem, wasn't replacing dots in class' super-class qualified name slashes.

so class had superclass of "java.lang.object", rather "java/lang/object", required.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -