Community
Participate
Working Groups
I'm experimenting with GraalVM to compile an SWT application to native. So far it worked out, but only by a lot of manual steps for the json file that contains a list of all Java fields/methods that need to be kept for accessing from swt native libraries.
Created attachment 284492 [details] script, configuration for tiny SWT code
- unpack the .zip file in an empty directory - put the org.eclipse.swt.win32.win32.x86_64.jar as swt.jar in that directory - extract the swt-win32-<build>.dll from the swt.jar as swt-win32.dll in parallel - invoke build.cmd => an .exe file of ~15MB will be created - run that .exe file and enjoy a native SWT application
Thomas, this is very interesting. However, it is not clear what you request with this bug.
I thought, the subject would be clear enough?
Created attachment 284499 [details] build script with some stuff I had to add. (In reply to Thomas Singer from comment #4) > I thought, the subject would be clear enough? If you think the subject has the complete requirement then it is fine. I did not know GraalVM so I would have liked some more information. (In reply to Thomas Singer from comment #1) > Created attachment 284492 [details] > script, configuration for tiny SWT code I tried your example from scratch. * After downloading GraalVM the script complained about missing install-image * I did: gu install native-image Then I found that it required VS so I installed the community edition and the C++ components. After this was done, it still did not build. The process complained about DPUtil being intialized at build time and the script suggested to add: * -H:+TraceClassInitialization and after that it suggested to add: * --initialize-at-build-time=org.eclipse.swt.internal.DPIUtil After this was done, the buld succeeded. And I had a 23MB exe that worked. I have attached the updated script for anyone interested.
My created executable has a size of 15MB and the steps work fine on 2 different systems. I just had to use the Visual Studio Installer 2019 to install the C++ build tools. BTW, use $ editbin /SUBSYSTEM:Windows main.exe to remove the console window that occurs when launching. With RCEdit from https://github.com/electron/rcedit it is easy to set an icon for the created executable.