when try compile class javac, compilation error , test.class not created.
public class test { public static void main(string[] args) { int x = 1l; // <- cannot compile } }
but when create class in eclipse, can see test.class appears in target/classes. when try run class command line java.exe,
exception in thread "main" java.lang.error: unresolved compilation problem:
type mismatch: cannot convert long int
does eclipse use own special java compiler create broken .class? how java.exe know complilation problems in .class?
this how java compiler knows compilation error in class.
public static void main(string[] paramarrayofstring) { throw new error("unresolved compilation problem: \n\ttype mismatch: cannot convert long int.\n"); }
if decompile class file, can see above main()
method of class file, compiler has generated. because of compiler eclipse uses (eclipse compiler java) not same standard java compiler!
Comments
Post a Comment