Open Skhmt opened 5 years ago
The problem here is that we still mark the whole JDK as build-time by default. The error message is misleading here--I am improving this case in a separate PR.
Here you need to see what pulls those instances in the heap and mark that as run-time as well. We have another improvement that should show you the stack trace for when those got initialized.
Till those PRs, you can attach with a debugger (--debug-attach
) and see when the classes get instantiated. Then you can delay the classes that instantiate the illegal elements.
Anything new on this issue? I also run over it using the following code:
import java.awt.BorderLayout; import java.awt.Container; import java.awt.Dimension; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.WindowConstants;
public class GUIlauncher {
private static void createAndShowGUI() {
JFrame frame = new JFrame("Hello World from Java");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(750, 500));
JComboBox
[guilauncher:11788] classlist: 4,565.27 ms
[guilauncher:11788] (cap): 2,597.87 ms
[guilauncher:11788] setup: 4,542.97 ms
[guilauncher:11788] analysis: 25,561.63 ms
Warning: Aborting stand-alone image build. Unsupported features in 2 methods
Detailed message:
Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image run time. The object was probably created by a class initializer and is reachable from a static field. By default, all class initialization is done during native image building.You can manually delay class initialization to image run time by using the option -H:ClassInitialization=
Any update on this? I am also unable to build a swing application on linux using native-image and --no-fallback option.
I can build using this:
[helder@priceshooter bin]$ ./native-image -Dsun.java2d.opengl=false GraalTest graaltest --no-fallback --initialize-at-run-time=sun.java2d.opengl
Build on Server(pid: 22022, port: 34217)*
[graaltest:22022] classlist: 1,033.71 ms
[graaltest:22022] (cap): 757.28 ms
[graaltest:22022] setup: 1,752.65 ms
[graaltest:22022] (typeflow): 8,958.36 ms
[graaltest:22022] (objects): 7,474.16 ms
[graaltest:22022] (features): 396.55 ms
[graaltest:22022] analysis: 17,254.32 ms
[graaltest:22022] (clinit): 220.61 ms
[graaltest:22022] universe: 593.90 ms
[graaltest:22022] (parse): 1,054.77 ms
[graaltest:22022] (inline): 2,159.05 ms
[graaltest:22022] (compile): 12,253.07 ms
[graaltest:22022] compile: 16,189.83 ms
[graaltest:22022] image: 1,013.48 ms
[graaltest:22022] write: 217.79 ms
[graaltest:22022] [total]: 38,185.44 ms
But when I run the executable:
[helder@priceshooter bin]$ ./graaltest
Exception in thread "main" java.lang.IllegalArgumentException: AWT is currently not supported on Substrate VM
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:37)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1736)
at java.awt.EventQueue.invokeLater(EventQueue.java:1294)
at GraalTest.main(GraalTest.java:7)
Any idea if Swing/AWT will be supported?
I have the same problem. Unfortunately the compiled exe is not working alone. If you store the jar file in the same folder with the exe, it works, but without the jar could not be run… The program breaks with a AWT Thread.. If you compile the program, without reffering a swing window instance, then it could be compiled.. but running with a swing window, the system could not find the MAIN entrance point of the compiled exe.. Instantiating the swing window with a method, then ERRORS are coming all the time and all the way….
It seems that only console applications can be made .. But this is nonsense, mixture with NET Framework and Java.. appjav source code makking.. Would it be good if it worked, but how long would it take? I tried with 8u221, but unfortunately the end result is not a standalone executable .. The JAR is already an executable, then why is this all?
I would suggest that if the EXE only work with JAR, put the resources and required codes for running the EXE into the JAR.
I’m curious if there is a solution for this? I’m having the same problem with a relatively simple Swing application.
If it helps to know it, here’s a simple test app:
import java.awt.*;
import javax.swing.*;
public class JFrameExample {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
displayJFrame();
}
});
}
static void displayJFrame() {
JFrame frame = new JFrame("My JFrame Example");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setPreferredSize(new Dimension(400, 200));
frame.pack();
frame.setVisible(true);
}
}
And this is the result I get with the native-image
command:
> native-image JFrameExample
Build on Server(pid: 18953, port: 55329)
[jframeexample:18953] classlist: 169.84 ms
[jframeexample:18953] (cap): 808.36 ms
[jframeexample:18953] setup: 1,050.86 ms
[jframeexample:18953] analysis: 4,669.92 ms
Warning: Aborting stand-alone image build. Unsupported features in 2 methods
Detailed message:
Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image run time. The object was probably created by a class initializer and is reachable from a static field. By default, all class initialization is done during native image building.You can manually delay class initialization to image run time by using the option -H:ClassInitialization=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: object sun.awt.AWTAutoShutdown
method sun.awt.AWTAutoShutdown.getInstance()
Call path from entry point to sun.awt.AWTAutoShutdown.getInstance():
at sun.awt.AWTAutoShutdown.getInstance(AWTAutoShutdown.java:133)
at java.awt.EventQueue.detachDispatchThread(EventQueue.java:1137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:88)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:460)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image run time. The object was probably created by a class initializer and is reachable from a static field. By default, all class initialization is done during native image building.You can manually delay class initialization to image run time by using the option -H:ClassInitialization=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: object sun.java2d.opengl.OGLRenderQueue
field sun.java2d.opengl.OGLRenderQueue.theInstance
Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Build on Server(pid: 18953, port: 55329)
[jframeexample:18953] classlist: 179.46 ms
[jframeexample:18953] (cap): 809.14 ms
[jframeexample:18953] setup: 1,064.64 ms
[jframeexample:18953] (typeflow): 1,339.48 ms
[jframeexample:18953] (objects): 1,492.08 ms
[jframeexample:18953] (features): 100.08 ms
[jframeexample:18953] analysis: 2,981.23 ms
[jframeexample:18953] (clinit): 55.78 ms
[jframeexample:18953] universe: 156.34 ms
[jframeexample:18953] (parse): 210.12 ms
[jframeexample:18953] (inline): 531.07 ms
[jframeexample:18953] (compile): 1,324.18 ms
[jframeexample:18953] compile: 2,226.73 ms
[jframeexample:18953] image: 217.91 ms
[jframeexample:18953] write: 89.76 ms
[jframeexample:18953] [total]: 6,959.42 ms
Warning: Image 'jframeexample' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation).
I’m just getting started with GraalVM, but I thought it would be great to create Swing apps as executables because they tend to start so slow, and consume a lot of RAM for even basic apps.
Thanks!
I am still out of luck... Devs, please help us!
From the next release (already in master) you can use -H:+TraceClassInitialization to see how this Thread got initialized. You need to use --initialize-at-build-time
in the right places to prevent this from happening.
When you come up with a working formula, we should merge this into the repo as this falls under the JDK.
That will be great, I’m looking forward to it!
I think once Graal is built with later JDKs that support for AWT will be included. The newer JDKs will most likely avoid using class init threads that are not supported by native-image.
I tried again to build a "hello world" Swing jar with GraalVM CE 19.2.0 and got a huge amount of errors that I have no idea how to solve:
C:\nitest>C:\graalvm-ce-19.2.0\bin\native-image -jar .\helloworlds.jar --no-fallback --initialize-at-run-time=sun.java2d.d3d,sun.java2d.opengl
[helloworlds:13808] classlist: 1,453.93 ms
[helloworlds:13808] (cap): 1,604.06 ms
[helloworlds:13808] setup: 2,355.57 ms
[helloworlds:13808] (typeflow): 6,219.09 ms
[helloworlds:13808] (objects): 5,413.88 ms
[helloworlds:13808] (features): 355.08 ms
[helloworlds:13808] analysis: 12,229.48 ms
[helloworlds:13808] (clinit): 191.90 ms
[helloworlds:13808] universe: 472.52 ms
[helloworlds:13808] (parse): 775.62 ms
[helloworlds:13808] (inline): 2,242.06 ms
[helloworlds:13808] (compile): 6,919.82 ms
[helloworlds:13808] compile: 10,547.76 ms
[helloworlds:13808] image: 909.52 ms
[helloworlds:13808] write: 160.69 ms
Fatal error: java.lang.RuntimeException: java.lang.RuntimeException: host C compiler or linker does not seem to work: java.lang.RuntimeException: returned 2
Running command: CL /MD /Zi /PDBSTRIPPED /FeC:\nitest\helloworlds.exe C:\Users\S\AppData\Local\Temp\SVM-4777097413826739274\helloworlds.obj C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib C:\graalvm-ce-19.2.0\jre\lib\java.lib C:\graalvm-ce-19.2.0\jre\lib\net.lib C:\graalvm-ce-19.2.0\jre\lib\nio.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib C:\graalvm-ce-19.2.0\jre\lib\zip.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib C:\graalvm-ce-19.2.0\jre\lib\java.lib C:\graalvm-ce-19.2.0\jre\lib\net.lib C:\graalvm-ce-19.2.0\jre\lib\nio.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib C:\graalvm-ce-19.2.0\jre\lib\zip.lib /link /INCREMENTAL:NO /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:OLDNAMES /LIBPATH:C:\graalvm-ce-19.2.0\jre\lib /LIBPATH:C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64 advapi32.lib ws2_32.lib secur32.lib iphlpapi.lib
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '/PDBSTRIPPED'
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/debug
/out:C:\nitest\helloworlds.exe
/INCREMENTAL:NO /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:OLDNAMES
/LIBPATH:C:\graalvm-ce-19.2.0\jre\lib
/LIBPATH:C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64
advapi32.lib
ws2_32.lib
secur32.lib
iphlpapi.lib
C:\Users\S\AppData\Local\Temp\SVM-4777097413826739274\helloworlds.obj
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib
C:\graalvm-ce-19.2.0\jre\lib\java.lib
C:\graalvm-ce-19.2.0\jre\lib\net.lib
C:\graalvm-ce-19.2.0\jre\lib\nio.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib
C:\graalvm-ce-19.2.0\jre\lib\zip.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib
C:\graalvm-ce-19.2.0\jre\lib\java.lib
C:\graalvm-ce-19.2.0\jre\lib\net.lib
C:\graalvm-ce-19.2.0\jre\lib\nio.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib
C:\graalvm-ce-19.2.0\jre\lib\zip.lib
Creating library C:\nitest\helloworlds.lib and object C:\nitest\helloworlds.exp
java.lib(AccessController.obj) : error LNK2019: unresolved external symbol JVM_DoPrivileged referenced in function Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2
java.lib(AccessController.obj) : error LNK2019: unresolved external symbol JVM_GetStackAccessControlContext referenced in function Java_java_security_AccessController_getStackAccessControlContext
java.lib(AccessController.obj) : error LNK2019: unresolved external symbol JVM_GetInheritedAccessControlContext referenced in function Java_java_security_AccessController_getInheritedAccessControlContext
C:\nitest\helloworlds.exe : fatal error LNK1120: 3 unresolved externals
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:593)
at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:461)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:310)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:448)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:113)
Caused by: java.lang.RuntimeException: host C compiler or linker does not seem to work: java.lang.RuntimeException: returned 2
Running command: CL /MD /Zi /PDBSTRIPPED /FeC:\nitest\helloworlds.exe C:\Users\S\AppData\Local\Temp\SVM-4777097413826739274\helloworlds.obj C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib C:\graalvm-ce-19.2.0\jre\lib\java.lib C:\graalvm-ce-19.2.0\jre\lib\net.lib C:\graalvm-ce-19.2.0\jre\lib\nio.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib C:\graalvm-ce-19.2.0\jre\lib\zip.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib C:\graalvm-ce-19.2.0\jre\lib\java.lib C:\graalvm-ce-19.2.0\jre\lib\net.lib C:\graalvm-ce-19.2.0\jre\lib\nio.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib C:\graalvm-ce-19.2.0\jre\lib\zip.lib /link /INCREMENTAL:NO /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:OLDNAMES /LIBPATH:C:\graalvm-ce-19.2.0\jre\lib /LIBPATH:C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64 advapi32.lib ws2_32.lib secur32.lib iphlpapi.lib
Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '/PDBSTRIPPED'
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/debug
/out:C:\nitest\helloworlds.exe
/INCREMENTAL:NO /NODEFAULTLIB:LIBCMT /NODEFAULTLIB:OLDNAMES
/LIBPATH:C:\graalvm-ce-19.2.0\jre\lib
/LIBPATH:C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64
advapi32.lib
ws2_32.lib
secur32.lib
iphlpapi.lib
C:\Users\S\AppData\Local\Temp\SVM-4777097413826739274\helloworlds.obj
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib
C:\graalvm-ce-19.2.0\jre\lib\java.lib
C:\graalvm-ce-19.2.0\jre\lib\net.lib
C:\graalvm-ce-19.2.0\jre\lib\nio.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib
C:\graalvm-ce-19.2.0\jre\lib\zip.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\ffi.lib
C:\graalvm-ce-19.2.0\jre\lib\java.lib
C:\graalvm-ce-19.2.0\jre\lib\net.lib
C:\graalvm-ce-19.2.0\jre\lib\nio.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\libchelper.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\strictmath.lib
C:\graalvm-ce-19.2.0\jre\lib\svm\clibraries\windows-amd64\jvm.lib
C:\graalvm-ce-19.2.0\jre\lib\zip.lib
Creating library C:\nitest\helloworlds.lib and object C:\nitest\helloworlds.exp
java.lib(AccessController.obj) : error LNK2019: unresolved external symbol JVM_DoPrivileged referenced in function Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2
java.lib(AccessController.obj) : error LNK2019: unresolved external symbol JVM_GetStackAccessControlContext referenced in function Java_java_security_AccessController_getStackAccessControlContext
java.lib(AccessController.obj) : error LNK2019: unresolved external symbol JVM_GetInheritedAccessControlContext referenced in function Java_java_security_AccessController_getInheritedAccessControlContext
C:\nitest\helloworlds.exe : fatal error LNK1120: 3 unresolved externals
at com.oracle.svm.hosted.image.NativeBootImageViaCC.write(NativeBootImageViaCC.java:350)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:657)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:444)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
I can build trivial .jars with native-image just fine.
@pejovica assigning to you as the problem is in missing native implementations for security functions.
I'm having the same problem as @Skhmt
@vjovanov @pejovica any update?
This is a major shortcoming. I'm unable to find any workaround to build even simplest swing applications.
It would appear as though SubstrateVM doesn't support AWT.
It's taken 5+ years to get to here. Adding AWT could take many more years.
Don't think so, it is just not our priority. If you want, you would probably get it running in a matter of days.
Probably the only thing needed is to create the JNI config. But what about threads started in ctors? I think that was another issue.
You would need to define which classes should be marked with --initialize-at-run-time
. The nasty thing is that -H:+TraceClassInitialization
does not work for most of the JDK so you would have to use a debugger (--attach-debug
) and put breakpoints in constructors of classes that end up in the image heap.
If there’s ever anything I can do as a Swing developer, just let me know, I’ll be glad to help. I know Swing/GUI apps aren’t as popular as web apps, but I still have customers that want them, and I’m always apologizing for the RAM they consume. If GraalVM could help with that issue, that would be awesome.
You just start building an image and adding a flag by flag that fixes the problems. If you want to invest the time I will guide you through the process.
Sure, I’ll be glad to do what I can.
If it were possible to publish some detailed instructions, it would be great.
The error messages should lead you through the problems, simply try to build your app and see what goes wrong. We can go through them one by one and fix everything that is unclear on the way.
Before the next attempt, is there anyone here who has really been able to make it work? I mean, who has been able to make a 100% functional build.
EDIT: Ok, partially functional?
I’m glad to help if I can. The comment I shared above shows a small Swing example that fails to compile. I just don’t know how to get started in trying to make it work.
OK, this already shows a few problems with the error message. Are you using the tip of Graal we should probably do that to get in sync. The message said that you should see who initialized the Thread and try to delay it.
I would start with adding --no-fallback
and --initialize-at-run-time=sun.awt
to the image build command.
Oh great! You are just trying to fix the same thing as I was doing now for some hours without success. I just tried your suggestions. But I'm not sure if it is going to help much. Anyway here is the output:
> Task :nativeImage
Shutdown Server(pid: 2034, port: 45727)
Build on Server(pid: 4774, port: 43563)*
[testWindow:4774] classlist: 5,078.95 ms
[testWindow:4774] (cap): 3,790.76 ms
[testWindow:4774] setup: 6,840.90 ms
[testWindow:4774] analysis: 23,997.90 ms
Error: Unsupported features in 12 methods
Detailed message:
Error: No instances of sun.awt.X11GraphicsConfig$X11GCDisposerRecord are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: object java.util.Hashtable$Entry
object java.util.Hashtable$Entry[]
object java.util.Hashtable
method sun.java2d.Disposer.run()
Call path from entry point to sun.java2d.Disposer.run():
at sun.java2d.Disposer.run(Disposer.java:148)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: No instances of sun.awt.X11GraphicsEnvironment are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.GraphicsEnvironment.localEnv
Error: No instances of sun.awt.resources.awt are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.Toolkit.resources
Error: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.Dialog.modalDialogs
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.<init>(FontRenderContext.java:150)
Call path from entry point to java.awt.font.FontRenderContext.<init>(AffineTransform, Object, Object):
at java.awt.font.FontRenderContext.<init>(FontRenderContext.java:145)
at sun.font.GlyphLayout$SDCache.get(GlyphLayout.java:321)
at sun.font.GlyphLayout.layout(GlyphLayout.java:383)
at sun.font.ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:329)
at sun.font.ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:315)
at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:619)
at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:548)
at sun.font.ExtendedTextSourceLabel.getCharX(ExtendedTextSourceLabel.java:357)
at java.awt.font.TextLine$1.computeFunction(TextLine.java:494)
at java.awt.font.TextLine.applyFunctionAtIndex(TextLine.java:653)
at java.awt.font.TextLine.getCharAdvance(TextLine.java:665)
at java.awt.font.TextLayout.buildCache(TextLayout.java:693)
at java.awt.font.TextLayout.ensureCache(TextLayout.java:664)
at java.awt.font.TextLayout.hashCode(TextLayout.java:2577)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(SwingUtilities2.java:137)
Call path from entry point to sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(Map):
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(SwingUtilities2.java:137)
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:154)
at javax.swing.plaf.metal.MetalLookAndFeel$AATextListener.propertyChange(MetalLookAndFeel.java:2233)
at com.oracle.svm.reflect.PropertyChangeListener_propertyChange_da400dea6b07c6d5952f675e42c04fa11307a714_7.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.swing.SwingLazyValue.createValue(SwingLazyValue.java:73)
at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:216)
at javax.swing.UIDefaults.get(UIDefaults.java:161)
at java.util.concurrent.ConcurrentHashMap.equals(ConcurrentHashMap.java:1350)
at java.util.HashMap.getNode(HashMap.java:579)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Font.getItalicAngle(Font.java:2139)
Call path from entry point to java.awt.Font.getItalicAngle(FontRenderContext):
at java.awt.Font.getItalicAngle(Font.java:2138)
at java.awt.Font.defaultLineMetrics(Font.java:2201)
at java.awt.Font.getLineMetrics(Font.java:2283)
at java.awt.font.TextLayout.standardInit(TextLayout.java:638)
at java.awt.font.TextLayout.<init>(TextLayout.java:538)
at sun.awt.im.CompositionArea.setText(CompositionArea.java:205)
at sun.awt.im.CompositionAreaHandler.releaseCompositionArea(CompositionAreaHandler.java:132)
at sun.awt.im.InputMethodContext.releaseCompositionArea(InputMethodContext.java:244)
at sun.awt.im.InputContext$1.run(InputContext.java:653)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.getAntiAliasingHint(FontRenderContext.java:262)
Call path from entry point to java.awt.font.FontRenderContext.getAntiAliasingHint():
at java.awt.font.FontRenderContext.getAntiAliasingHint(FontRenderContext.java:260)
at java.awt.font.FontRenderContext.hashCode(FontRenderContext.java:349)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.getFractionalMetricsHint(FontRenderContext.java:282)
Call path from entry point to java.awt.font.FontRenderContext.getFractionalMetricsHint():
at java.awt.font.FontRenderContext.getFractionalMetricsHint(FontRenderContext.java:280)
at java.awt.font.FontRenderContext.hashCode(FontRenderContext.java:350)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1722)
Call path from entry point to sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector, AffineTransform, AffineTransform):
at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1704)
at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1366)
at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1353)
at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1323)
at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:663)
at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:703)
at java.util.HashMap.getNode(HashMap.java:579)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Window.addNotify(Window.java:767)
Call path from entry point to java.awt.Window.addNotify():
at java.awt.Window.addNotify(Window.java:759)
at java.awt.Frame.addNotify(Frame.java:487)
at java.awt.Window.pack(Window.java:807)
at ch.romix.graal.nativeimage.JFrameExample.displayJFrame(JFrameExample.java:19)
at ch.romix.graal.nativeimage.JFrameExample$1.run(JFrameExample.java:10)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Window.removeNotify(Window.java:779)
Call path from entry point to java.awt.Window.removeNotify():
at java.awt.Window.removeNotify(Window.java:778)
at java.awt.Frame.removeNotify(Frame.java:1041)
at java.awt.Window$1DisposeAction.run(Window.java:1190)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
com.oracle.svm.core.util.UserError$UserException: Unsupported features in 12 methods
Detailed message:
Error: No instances of sun.awt.X11GraphicsConfig$X11GCDisposerRecord are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: object java.util.Hashtable$Entry
object java.util.Hashtable$Entry[]
object java.util.Hashtable
method sun.java2d.Disposer.run()
Call path from entry point to sun.java2d.Disposer.run():
at sun.java2d.Disposer.run(Disposer.java:148)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: No instances of sun.awt.X11GraphicsEnvironment are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.GraphicsEnvironment.localEnv
Error: No instances of sun.awt.resources.awt are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.Toolkit.resources
Error: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.Dialog.modalDialogs
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.<init>(FontRenderContext.java:150)
Call path from entry point to java.awt.font.FontRenderContext.<init>(AffineTransform, Object, Object):
at java.awt.font.FontRenderContext.<init>(FontRenderContext.java:145)
at sun.font.GlyphLayout$SDCache.get(GlyphLayout.java:321)
at sun.font.GlyphLayout.layout(GlyphLayout.java:383)
at sun.font.ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:329)
at sun.font.ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:315)
at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:619)
at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:548)
at sun.font.ExtendedTextSourceLabel.getCharX(ExtendedTextSourceLabel.java:357)
at java.awt.font.TextLine$1.computeFunction(TextLine.java:494)
at java.awt.font.TextLine.applyFunctionAtIndex(TextLine.java:653)
at java.awt.font.TextLine.getCharAdvance(TextLine.java:665)
at java.awt.font.TextLayout.buildCache(TextLayout.java:693)
at java.awt.font.TextLayout.ensureCache(TextLayout.java:664)
at java.awt.font.TextLayout.hashCode(TextLayout.java:2577)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(SwingUtilities2.java:137)
Call path from entry point to sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(Map):
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(SwingUtilities2.java:137)
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:154)
at javax.swing.plaf.metal.MetalLookAndFeel$AATextListener.propertyChange(MetalLookAndFeel.java:2233)
at com.oracle.svm.reflect.PropertyChangeListener_propertyChange_da400dea6b07c6d5952f675e42c04fa11307a714_7.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.swing.SwingLazyValue.createValue(SwingLazyValue.java:73)
at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:216)
at javax.swing.UIDefaults.get(UIDefaults.java:161)
at java.util.concurrent.ConcurrentHashMap.equals(ConcurrentHashMap.java:1350)
at java.util.HashMap.getNode(HashMap.java:579)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Font.getItalicAngle(Font.java:2139)
Call path from entry point to java.awt.Font.getItalicAngle(FontRenderContext):
at java.awt.Font.getItalicAngle(Font.java:2138)
at java.awt.Font.defaultLineMetrics(Font.java:2201)
at java.awt.Font.getLineMetrics(Font.java:2283)
at java.awt.font.TextLayout.standardInit(TextLayout.java:638)
at java.awt.font.TextLayout.<init>(TextLayout.java:538)
at sun.awt.im.CompositionArea.setText(CompositionArea.java:205)
at sun.awt.im.CompositionAreaHandler.releaseCompositionArea(CompositionAreaHandler.java:132)
at sun.awt.im.InputMethodContext.releaseCompositionArea(InputMethodContext.java:244)
at sun.awt.im.InputContext$1.run(InputContext.java:653)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.getAntiAliasingHint(FontRenderContext.java:262)
Call path from entry point to java.awt.font.FontRenderContext.getAntiAliasingHint():
at java.awt.font.FontRenderContext.getAntiAliasingHint(FontRenderContext.java:260)
at java.awt.font.FontRenderContext.hashCode(FontRenderContext.java:349)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.getFractionalMetricsHint(FontRenderContext.java:282)
Call path from entry point to java.awt.font.FontRenderContext.getFractionalMetricsHint():
at java.awt.font.FontRenderContext.getFractionalMetricsHint(FontRenderContext.java:280)
at java.awt.font.FontRenderContext.hashCode(FontRenderContext.java:350)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1722)
Call path from entry point to sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector, AffineTransform, AffineTransform):
at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1704)
at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1366)
at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1353)
at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1323)
at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:663)
at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:703)
at java.util.HashMap.getNode(HashMap.java:579)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Window.addNotify(Window.java:767)
Call path from entry point to java.awt.Window.addNotify():
at java.awt.Window.addNotify(Window.java:759)
at java.awt.Frame.addNotify(Frame.java:487)
at java.awt.Window.pack(Window.java:807)
at ch.romix.graal.nativeimage.JFrameExample.displayJFrame(JFrameExample.java:19)
at ch.romix.graal.nativeimage.JFrameExample$1.run(JFrameExample.java:10)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Window.removeNotify(Window.java:779)
Call path from entry point to java.awt.Window.removeNotify():
at java.awt.Window.removeNotify(Window.java:778)
at java.awt.Frame.removeNotify(Frame.java:1041)
at java.awt.Window$1DisposeAction.run(Window.java:1190)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
at com.oracle.svm.core.util.UserError.abort(UserError.java:75)
at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:223)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:737)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:526)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:444)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 12 methods
Detailed message:
Error: No instances of sun.awt.X11GraphicsConfig$X11GCDisposerRecord are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: object java.util.Hashtable$Entry
object java.util.Hashtable$Entry[]
object java.util.Hashtable
method sun.java2d.Disposer.run()
Call path from entry point to sun.java2d.Disposer.run():
at sun.java2d.Disposer.run(Disposer.java:148)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: No instances of sun.awt.X11GraphicsEnvironment are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.GraphicsEnvironment.localEnv
Error: No instances of sun.awt.resources.awt are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.Toolkit.resources
Error: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace: field java.awt.Dialog.modalDialogs
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.<init>(FontRenderContext.java:150)
Call path from entry point to java.awt.font.FontRenderContext.<init>(AffineTransform, Object, Object):
at java.awt.font.FontRenderContext.<init>(FontRenderContext.java:145)
at sun.font.GlyphLayout$SDCache.get(GlyphLayout.java:321)
at sun.font.GlyphLayout.layout(GlyphLayout.java:383)
at sun.font.ExtendedTextSourceLabel.createGV(ExtendedTextSourceLabel.java:329)
at sun.font.ExtendedTextSourceLabel.getGV(ExtendedTextSourceLabel.java:315)
at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:619)
at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:548)
at sun.font.ExtendedTextSourceLabel.getCharX(ExtendedTextSourceLabel.java:357)
at java.awt.font.TextLine$1.computeFunction(TextLine.java:494)
at java.awt.font.TextLine.applyFunctionAtIndex(TextLine.java:653)
at java.awt.font.TextLine.getCharAdvance(TextLine.java:665)
at java.awt.font.TextLayout.buildCache(TextLayout.java:693)
at java.awt.font.TextLayout.ensureCache(TextLayout.java:664)
at java.awt.font.TextLayout.hashCode(TextLayout.java:2577)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(SwingUtilities2.java:137)
Call path from entry point to sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(Map):
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfoFromMap(SwingUtilities2.java:137)
at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:154)
at javax.swing.plaf.metal.MetalLookAndFeel$AATextListener.propertyChange(MetalLookAndFeel.java:2233)
at com.oracle.svm.reflect.PropertyChangeListener_propertyChange_da400dea6b07c6d5952f675e42c04fa11307a714_7.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.swing.SwingLazyValue.createValue(SwingLazyValue.java:73)
at javax.swing.UIDefaults.getFromHashtable(UIDefaults.java:216)
at javax.swing.UIDefaults.get(UIDefaults.java:161)
at java.util.concurrent.ConcurrentHashMap.equals(ConcurrentHashMap.java:1350)
at java.util.HashMap.getNode(HashMap.java:579)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Font.getItalicAngle(Font.java:2139)
Call path from entry point to java.awt.Font.getItalicAngle(FontRenderContext):
at java.awt.Font.getItalicAngle(Font.java:2138)
at java.awt.Font.defaultLineMetrics(Font.java:2201)
at java.awt.Font.getLineMetrics(Font.java:2283)
at java.awt.font.TextLayout.standardInit(TextLayout.java:638)
at java.awt.font.TextLayout.<init>(TextLayout.java:538)
at sun.awt.im.CompositionArea.setText(CompositionArea.java:205)
at sun.awt.im.CompositionAreaHandler.releaseCompositionArea(CompositionAreaHandler.java:132)
at sun.awt.im.InputMethodContext.releaseCompositionArea(InputMethodContext.java:244)
at sun.awt.im.InputContext$1.run(InputContext.java:653)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.getAntiAliasingHint(FontRenderContext.java:262)
Call path from entry point to java.awt.font.FontRenderContext.getAntiAliasingHint():
at java.awt.font.FontRenderContext.getAntiAliasingHint(FontRenderContext.java:260)
at java.awt.font.FontRenderContext.hashCode(FontRenderContext.java:349)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.font.FontRenderContext.getFractionalMetricsHint(FontRenderContext.java:282)
Call path from entry point to java.awt.font.FontRenderContext.getFractionalMetricsHint():
at java.awt.font.FontRenderContext.getFractionalMetricsHint(FontRenderContext.java:280)
at java.awt.font.FontRenderContext.hashCode(FontRenderContext.java:350)
at java.util.HashMap.hash(HashMap.java:339)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1722)
Call path from entry point to sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector, AffineTransform, AffineTransform):
at sun.font.StandardGlyphVector$GlyphStrike.create(StandardGlyphVector.java:1704)
at sun.font.StandardGlyphVector.getDefaultStrike(StandardGlyphVector.java:1366)
at sun.font.StandardGlyphVector.getGlyphStrike(StandardGlyphVector.java:1353)
at sun.font.StandardGlyphVector.initPositions(StandardGlyphVector.java:1323)
at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:663)
at sun.font.StandardGlyphVector.equals(StandardGlyphVector.java:703)
at java.util.HashMap.getNode(HashMap.java:579)
at java.util.HashMap.get(HashMap.java:557)
at com.oracle.svm.jni.access.JNIReflectionDictionary.getClassObjectByName(JNIReflectionDictionary.java:123)
at com.oracle.svm.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:326)
at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FindClass_3ec1032c6cb9443725d1e68194130533bfb04076(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Window.addNotify(Window.java:767)
Call path from entry point to java.awt.Window.addNotify():
at java.awt.Window.addNotify(Window.java:759)
at java.awt.Frame.addNotify(Frame.java:487)
at java.awt.Window.pack(Window.java:807)
at ch.romix.graal.nativeimage.JFrameExample.displayJFrame(JFrameExample.java:19)
at ch.romix.graal.nativeimage.JFrameExample$1.run(JFrameExample.java:10)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Trace:
at parsing java.awt.Window.removeNotify(Window.java:779)
Call path from entry point to java.awt.Window.removeNotify():
at java.awt.Window.removeNotify(Window.java:778)
at java.awt.Frame.removeNotify(Frame.java:1041)
at java.awt.Window$1DisposeAction.run(Window.java:1190)
at java.lang.Shutdown.runHooks(Shutdown.java:123)
at java.lang.Shutdown.sequence(Shutdown.java:167)
at java.lang.Shutdown.shutdown(Shutdown.java:234)
at com.oracle.svm.core.jdk.RuntimeSupport.shutdown(RuntimeSupport.java:181)
at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:176)
at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:133)
at com.oracle.graal.pointsto.BigBang.finish(BigBang.java:565)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:688)
... 7 more
Error: Image build request failed with exit status 1
> Task :nativeImage FAILED
Execution failed for task ':nativeImage'.
> Process 'command '/home/roman/.gradle/caches/com.palantir.graal/19.2.1/graalvm-ce-19.2.1/bin/native-image'' finished with non-zero exit value 1
Error: Unsupported features in 12 methods
Error: No instances of sun.awt.X11GraphicsConfig$X11GCDisposerRecord are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.X11GraphicsEnvironment are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.resources.awt are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.X11GraphicsConfig$X11GCDisposerRecord are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.X11GraphicsEnvironment are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.resources.awt are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 12 methods
Error: No instances of sun.awt.X11GraphicsConfig$X11GCDisposerRecord are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.X11GraphicsEnvironment are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.resources.awt are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Key are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.SunHints$Value are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of sun.awt.util.IdentityArrayList are allowed in the image heap as this class should be initialized at image runtime.Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked.
What I don't understand is this: Any attempt that I made just boiled down to my main method. Finally, I always had to set my main entry method or class to be initialized at run time. I do not quite understand how the decision is made to initialize classes of the JDK at build time. Maybe it would help to explain this process in greater detail. How do you find out which classes should be compiled AOT and how does that relate to class initialization.
PS: As I write this, I probably understand it a bit better... I will try again based on the native image output above.
For this one I would also initialize at build time sun.java2d
and java.awt.font
. There is a similar effort in issue https://github.com/oracle/graal/issues/1716 (\cc @vektory79 ) where the config is quite involved. I would prefer to have a smaller config that defines all the packages instead of individual classes as I think this would be more maintainable.
That config can be more simple in case the classes, that depends from initialize-at-run-time classes is also will be marked similar, automatically.
Also note, that configuration for JNI can't be simplified. At least trivially.
And one more note: native-image have bug (#1716), that prevent open the window. Other functionality seems lake workable.
Thank you for your help. I continue down that path. I'm now down to sun.misc.Unsafe. Will have to study the JNI thing and see if we can use learnings from plantUML.
Are you using the tip of Graal we should probably do that to get in sync.
Sorry for disappearing for a while, but I can work on this over the weekend, and I thought I’d see what you mean by this? It looks like the last release was on October 15th, so do you mean that release, or building Graal from the source code (which I don’t know how to do at the moment). Thanks!
If we want to work on swing you will have to build from source. The reason is that class initialization is not being tracked for the JDK classes and if something gets initialized we will have to use the debugger.
The README of graal should tell you how to build from source.
Cool, I just wanted to make sure I understood that. Thanks!
Hi @alvinj any luck with this?
Many thanks.
Hi @alvinj any luck with this?
No, sorry. I ended up in the hospital with some inflammation around my heart, and I haven’t been able to work on this.
Oh dear, sorry to hear about that, wishing you a speedy recovery @alvinj
Thank you, I appreciate it. I can only work a few hours a day right now, so I don’t have any real free time, but as soon as I do I’ll get back to this.
I had a similar issue with PDFBox which gave the OGLRenderQueue error on building. It turned out to be the inclusion of JBIG2Filter class which tried to dynamically load a java plug-in from javax.imageio.spi.IIORegistry.
Hi all, is there any news on this item? I tried to create a stand alone native-image with the latest version 19.3.1 but still no success? Are thereany plans to support swing applications with GraalVM? Thank you - cheers
Yes, we plan to support Swing, but it is not the highest of priorities ATM. All help from the community is welcome here.
I've made some progress with BufferedImage.
Steps:
Sample test:
import java.awt.image.BufferedImage;
public class test {
public static void main(String args[]) {
System.load(System.getProperty("user.dir") + "/awt.dll");
BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
bi.createGraphics();
System.out.println("ok");
}
}
But I get this error:
Exception in thread "main" java.lang.InternalError: Attempting to set SurfaceData ops twice
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_InternalError_2_0002e_0003cinit_0003e_00028Ljava_lang_String_2_00029V(JNIJavaCallWrappers.java:0)
at com.oracle.svm.jni.functions.JNIFunctions$NewObjectWithObjectArrayArgFunctionPointer.invoke(JNIFunctions.java)
at com.oracle.svm.jni.functions.JNIFunctions.ThrowNew(JNIFunctions.java:801)
at sun.awt.image.BufImgSurfaceData.initRaster(BufImgSurfaceData.java)
at sun.awt.image.BufImgSurfaceData.createDataIC(BufImgSurfaceData.java:274)
at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:95)
at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:74)
at sun.awt.image.BufImgSurfaceManager.<init>(BufImgSurfaceManager.java:55)
at sun.awt.image.SurfaceManager.getManager(SurfaceManager.java:79)
at sun.java2d.SurfaceData.getPrimarySurfaceData(SurfaceData.java:273)
at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:184)
at sun.java2d.HeadlessGraphicsEnvironment.createGraphics(HeadlessGraphicsEnvironment.java:70)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1182)
Maybe some initialize at run-time options could fix it?
Eventual those DLLs will need to be included into the LIB files in labsjdk. Then Graal needs to patch any and all classes that need to re-initialize at runtime. A lot of work :)
Made more progress today, found all the classes that need to be initialized at run-time and those that need reflection.
My test looks like this now:
import java.awt.image.BufferedImage;
public class test {
public static void main(String args[]) {
System.setProperty("java.awt.graphicsenv", "sun.awt.Win32GraphicsEnvironment");
System.load(System.getProperty("user.dir") + "/awt.dll");
BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
bi.createGraphics();
System.out.println("ok");
System.out.println(System.getProperty("java.awt.graphicsenv"));
}
}
The command line looks like this:
native-image --initialize-at-run-time=sun.awt,sun.awt.image,sun.awt.datatransfer,sun.awt.dnd,sun.awt.windows,sun.java2d,sun.font,sun.font.lookup,java.awt,java.awt.image,java.awt.image.renderable,java.awt.peer,java.awt.font,java.awt.dnd,java.awt.dnd.peer,javax.accessibility -H:+TraceClassInitialization -H:NativeLinkerOption=prefs.lib -H:JNIConfigurationFiles=graal.json -H:+ReportExceptionStackTraces test -Djava.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
And the graal.json file:
[
{
"name":"java.awt.image.ColorModel",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.awt.image.BufferedImage",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.awt.image.Raster",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.awt.image.SampleModel",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.awt.image.SinglePixelPackedSampleModel",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"sun.awt.image.IntegerComponentRaster",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.awt.Toolkit",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"java.awt.Insets",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"java.awt.Rectangle",
"allDeclaredFields":true,
"allDeclaredMethods":true
},
{
"name":"sun.awt.Win32GraphicsEnvironment",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true,
"allDeclaredClasses":true
}
]
But now I'm stuck at this error:
Exception in thread "main" java.lang.Error: Could not find class: sun.awt.Win32GraphicsEnvironment
at java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:115)
at java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at com.oracle.svm.core.hub.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:350)
at com.oracle.svm.core.hub.ClassInitializationInfo.initialize(ClassInitializationInfo.java:270)
at java.lang.Class.ensureInitialized(DynamicHub.java:499)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1181)
at test.main(test.java:8)
It looks like AWT is trying to reflect a class in the DLL which is not supported yet. Labsjdk will need to get those DLLs converted into LIBs before more progress is possible. I'll open a ticket there.
Thanks,
Hi, @pquiring. I have the experiment, that came mach far toward: https://github.com/vektory79/plantuml-native-image
I think, that it ca be interesting for your.
The key thing is that it needs large set of reflection in JNI for AWT.
@vektory79 Thanks for the example, quite complex.
It would be nice if there was an option to initialize a whole module at run time, like this:
--initialize-at-run-time=@java.desktop
There is such an option. Just put the package name without @
.
I tried to do what @pquiring did, with manually loading the awt.dll but no matter what I try, I keep getting this exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no awt in java.library.path
Loading the dll works through java, but not through native-image.
@kristofdho in native image you should use NativeLibrarySupport.singleton().loadLibrary
: https://github.com/vektory79/plantuml-native-image/blob/master/src/main/java/me/vektory79/plantuml/Main.java#L82 to load the native libraries.
Running:
C:\graalvm-ce-19.0.0\bin\native-image.cmd -jar jPatcher.jar --no-fallback
I get the following:
So then I run:
C:\graalvm-ce-19.0.0\bin\native-image.cmd -jar jPatcher.jar --no-fallback --initialize-at-run-time=sun.awt.AWTAutoShutdown,sun.java2d.opengl.OGLRenderQueue
Now I get:
What do I do now? It's saying to mark
sun.java2d.opengl.OGLRenderQueue
for initialization at run time when it's marked for initialization at build time and it says to mark it for initialization at build time when it's marked for initialization at run time.