[foreign] NPE when trying to lookup a symbol in the default library when no libraries are loaded

Sundararajan Athijegannathan sundararajan.athijegannathan at oracle.com
Wed Sep 12 18:08:11 UTC 2018

I don't think it is jshell vs. compiled java program. It must be 
something else - because simplest main code does not reproduce NPE for me.

import java.foreign.*;

public class Main {
   public static void main(String[] args) throws Exception {

java Main
Exception in thread "main" java.lang.NoSuchMethodException: Cannot find 
symbol  in library <default>
     at Main.main(Main.java:5)

fwiw, the "default library" is a pseudo Library that searches all 
symbols in the process.


On 12/09/18, 11:15 PM, Jorn Vernee wrote:
> Sundararajan Athijegannathan schreef op 2018-09-12 19:41:
>> I tried the following on Mac.
>> $ jshell
>> |  Welcome to JShell -- Version 12-internal
>> |  For an introduction type: /help intro
>> jshell> import java.foreign.*;
>> jshell>     Libraries.getDefaultLibrary().lookup("");
>> |  Exception java.lang.NoSuchMethodException: Cannot find symbol  in
>> library <default>
>> |        at ClassLoader$NativeLibrary.lookup (ClassLoader.java:2428)
>> |        at (#2:1)
>> I got the NSME as expected. It seems either it is Windows specific or
>> perhaps not the latest panama build [just guessing]
>> Thanks,
>> -Sundar
> In jshell I'm also seeing an NSME, so I guess jshell is loading a 
> native library.
> I'm just compiling a file with the code to repro in the main, and 
> getting and NPE.
> Jorn

More information about the panama-dev mailing list