Review Request: JDK-8181033: Confusing message: A JNI error has occurred, please check your installation and try again
Mandy Chung
mandy.chung at oracle.com
Thu May 25 17:25:20 UTC 2017
> On May 25, 2017, at 12:24 AM, David Holmes <david.holmes at oracle.com> wrote:
>
> Correction ...
>
> On 25/05/2017 5:00 PM, David Holmes wrote:
>> Hi Mandy
>> On 25/05/2017 8:10 AM, Mandy Chung wrote:
>>> http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8181033/webrev.00/
>>>
>>> This fixes the launcher to print the exception being thrown rather than
>>> the confusing message "Error: A JNI error has occurred, please check
>>> your installation and try again”. A few attempts to improve this to
>>> catch ClassNotFoundException and LinkageError. This catches other cases.
>> Based on the exception stack that Volker reported this looks fine - it catches the unexpected exceptions encountered during getMethod() and reports them.
>> One thing that confuses me though, is that Volker reported the problem as occurring due to verification - and he showed some VM log output to support that. But verification happens when the main class is loaded! The exception trace shows code that executes well after loading time. ??
>
> Never mind. The Class.forName call requests the class not be initialized, which means it will not be linked. Verification is actually part of linking. The class has to be initialized before getMethod can be invoked, and hence it must first be linked and thus verified.
Yes exactly. FWIW [1][2] are references to linking and initialization.
Mandy
[1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.4
[2] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.5
More information about the jigsaw-dev
mailing list