Panama and jextract on Windows

Duncan Gittins duncan.gittins at gmail.com
Wed Apr 28 14:58:56 UTC 2021


There is a small change in behaviour when using jextract code with
jpackage. I'm not sure if this is because of recent work to jpackage or
foreign-panama - or whether this is concern for you right now.

The jpackage within foreign-panama sets java.library.path for each
generated EXE to:

    -Djava.library.path=C:\Program Files\APPNAME\app;C:\Program
Files\APPNAME'

Any Panama code that is run by generated EXEs fails to load certain Windows
libraries:

      java.lang.IllegalArgumentException: Library not found: user32
            at
jdk.incubator.foreign/jdk.internal.foreign.LibrariesHelper.lookup(Unknown
Source)
            at
jdk.incubator.foreign/jdk.internal.foreign.LibrariesHelper.loadLibrary(Unknown
Source)
            at
jdk.incubator.foreign/jdk.incubator.foreign.LibraryLookup.ofLibrary(Unknown
Source)

The jpackage from current JDK16 with exact same jars from JDK17 and
--runtime-image made with jlink on JDK17 does not set java.library.path for
each EXE and the panama code runs fine.

Kind regards

Duncan


More information about the panama-dev mailing list