-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[native-image] Swing application cannot be compiled on Windows #3659
Comments
This is similar to #3575 |
@BullyWiiPlaza as suggested by @chirontt |
I used the Java 11 version of GraalVM before but got the same error using the Java 16 version so I thought the latest version has the best chances to work. However, now I setup a new project with similar code and the native-image compilation actually succeeded. Though, upon running the EXE it crashed and I got the following exception:
After tracing all API usages using the tracing agent and adding the configs to the
Looks like this is related to #1812 which is still an open issue so there does not seem to be a fix yet. |
@BullyWiiPlaza please try GraalVM 21.3-dev |
@BullyWiiPlaza, for your
|
I downloaded https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/21.3.0-dev-20210813_0049/graalvm-ce-java11-windows-amd64-dev.zip and used that version now (see results below).
It gives a
|
@BullyWiiPlaza |
@BullyWiiPlaza |
Wow, now it works and the GUI loads up, thanks for the patience.
This seems like something Oracle has forgotten to handle properly. Also the following exception came up after clicking the "Calculate" button for prime numbers:
Actually, even more events seem to be non-implemented:
Interacting with the Neither of those exceptions come up with the regular executable Jar. Other than that, the toy application works now. 👍 |
@BullyWiiPlaza AWT and wing support for windows is still a work in progress, please follow the below issue for more information |
Closing this because there is no activity in last 30 days |
This issue seems to still exist. I just compiled my simple Swing application and upon running I get: I'm using GraalVM for Java 17 Windows amd64 v22.2.0 |
You can manually copied some small files of the JAVA_HOME\lib to solve the problem in windows. And run with -Djava.home=. |
For anyone who gets here troubleshooting, here was my solution:
At the very beginning of my app (Very first thing in main) I did this:
This causes the swing font data to get looked up from the |
Am I misunderstanding the purpose of GraalVM Native Image? Shouldn't the executable not be dependent on the java.home files? I'm having the same issue as the original user. This is so confusing. |
The Swing/AWT issue still exists with the latest version of JDK 20 (
I know #3084 is still open, but it's been almost three years and I hope it gets addressed one day... |
Hi, I just want to note that the Using graalvm 20 on Windows, compiling a Swing app with FlatLaf and miglayout (and no other dependencies other than what the tutorial linked here advises) Not sure that setting JAVA_HOME env var is viable, I am trying to produce a standalone EXE for users without JDK/JRE installed |
Please see my note above: #3659 (comment) No need to have the jvm, just a couple files from it along side the exe. Still, I am amazed that this has not been fixed by the graalvm team, it just shows how immature graalvm is still. |
Indeed. I had to translate your gradle fragment to maven and I think I may have gotten it working, but my native EXE is now throwing tons of In case it is useful to anyone else, the maven script is (put this in the
|
‘graalvm.groupId’ and ‘graalvm.version’ what is it? |
Describe the issue
When compiling my simple hello world Swing application on Windows using native-image, it does not work.
Steps to reproduce the issue
native-image -jar "Hello World.jar" "Hello World"
Fatal error:com.oracle.svm.core.util.VMError$HostedError: should not reach here
Describe GraalVM and your environment:
More details
What's the current state of Swing support for Windows? Since Windows is the most popular desktop OS, I don't understand why apparently only Linux support has been implemented. Is there any command line switch or similar I can try to potentially make it work for Windows right now?
Related issue: #1327
The text was updated successfully, but these errors were encountered: