oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.36k stars 1.63k forks source link

Native-image failed to handle java2d classes #697

Closed plankp closed 11 months ago

plankp commented 6 years ago

Take a very simple GUI app:

import javax.swing.JFrame;

public class DummyClass {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setSize(100, 100);
        frame.setResizable(false);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

After compiling it with javac and making sure it runs, running native-image on it results in the following error:

image

Adding the flags --delay-class-initialization-to-runtime on DummyClass still results in the same error and apply it on sun.java2d.opengl.OGLRenderQueue results in the following:

image


Is using native-image on swing not supported? Or what is the workaround for this? (Or am I misunderstanding how native-image works? I am using debian 9.5.0)

chumer commented 6 years ago

Swing requires AWT and that is not yet supported by native-image. It does not mean it is not possible but it is not trivial to support.

jdevp commented 6 years ago

It would be very nice to see that native-image support will support Swing/Java2D, which will bring Java on client to the next level.

spavlusieva commented 11 months ago

hi @plankp , this issue has been inactive for more than 180 days. We’ll close it to focus on current issues. In case it’s still relevant, please reopen it and we’ll take another look. Thank you!

vjovanov commented 11 months ago

This issue is likely fixed in the latest release.