LinkageError and ExceptionInInitializerError

B

Boaz

Hi all,

I have a program (not mine) that throws ExceptionInInitializerError
and I'm trying to figure out what it means. I saw the short
documentation in Sun's Java api but I'm looking for something more
descriptive about it and its parent - LinkageError.

If anyone can shed some more light or direct me to some place on the
net I'll be greatful.

Thanks,
Boaz.
 
J

John C. Bollinger

Boaz said:
I have a program (not mine) that throws ExceptionInInitializerError
and I'm trying to figure out what it means. I saw the short
documentation in Sun's Java api but I'm looking for something more
descriptive about it and its parent - LinkageError.

If anyone can shed some more light or direct me to some place on the
net I'll be greatful.

ExceptionInInitializerError means exactly what its name says: an
exception was thrown by a class' initialization code. The
initialization code consists of the initialization expressions of all
static variables plus any static initialization blocks belonging to the
class. The compiler will reject initialization code that has the
capability of throwing a checked exception, but it cannot avoid the
possibility of initialization code throwing an unchecked exception. (It
is also conceivable that some class used by another class'
initialization code is modified so that it throws checked exceptions
where it didn't previously, thus potentially sidestepping the
compile-time check.)

The definitive source of information about this topic would be the Java
Virtual Machine Specification, although a Java-centric description is
also provided in the Java Language Specification
(http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44487).
In the JLS you might want to look specifically at section 12.4.2.


John Bollinger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top