I'm facing a very peculiar problem; the compilation goes through
successfully, but I get the following error message during runtime:
"Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructo
rAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at
edu.gatech.ecl.augoffice.common.KimuraProperties.get(KimuraProperties.java:100)
at
edu.gatech.ecl.augoffice.interpreter.Interpreter.<init>(Interpreter.java:24)
at edu.gatech.ecl.augoffice.test.UtilsTest.<init>(UtilsTest.java:210)
at edu.gatech.ecl.augoffice.test.UtilsTest.main(UtilsTest.java:732)"
KimuraProperties is a class that is never instantiated, but is statically
initialized when its first static method is called (via a static { } block).
Does anyone have any ideas what would possibly be causing this?
P.S. To make things even more complicated, if I run the application
through Eclipse, it runs OK!? The problem only appears if I run it on the
command line.
Thanx :)
Nikitas Liogas
rc
Hmmm, when eclipse compiles a class that contains a method which is not
normally compilable, due to a syntax error or whatnot, the bytecode for
the offending method isn't included. Instead, the compiler inserts some
boilerplate code so that if the method is called, an Error is thrown as
shown above. This feature allows classes with compile-time errors to be
executed, provided that the 'bad' code isn't called.
There is no reason (aside from a bug perhaps) why Eclipse would run such
code, while some other VM would not. Can you boil the code down to a
small test case?
Jim S.