如何设置/运行 jaotc 以便它可以找到标准的 JDK 类?
使用 JDK 9 过期的 AOT 编译器来预构建一些库,许多库由于类似的原因而失败。例如
jaotc --compile-for-tiered --info --output ../aoclib/postgresql-9.4.1208.so --jar ./postgresql-9.4.1208.jar
结果
Compiling ../aoclib/postgresql-9.4.1208...
(85 ms)
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/win32/StdCallLibrary
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1007)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:545)
at java.base/java.net.URLClassLoader.access$100(URLClassLoader.java:83)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:453)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:447)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:446)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:890)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
at jdk.aot/jdk.tools.jaotc.collect.ClassSearch.loadClass(ClassSearch.java:55)
at jdk.aot/jdk.tools.jaotc.collect.ClassSearch.lambda$search$0(ClassSearch.java:47)
at jdk.aot/jdk.tools.jaotc.collect.jar.JarFileSource.eachClass(JarFileSource.java:47)
at jdk.aot/jdk.tools.jaotc.collect.ClassSearch.search(ClassSearch.java:47)
at jdk.aot/jdk.tools.jaotc.Main.run(Main.java:369)
at jdk.aot/jdk.tools.jaotc.Main.run(Main.java:306)
at jdk.aot/jdk.tools.jaotc.Main.main(Main.java:284)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.win32.StdCallLibrary
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
at java.base/java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:890)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 19 more