-
Notifications
You must be signed in to change notification settings - Fork 0
GraalVM
hrothwell edited this page Feb 21, 2023
·
3 revisions
This process is mostly outdated!! Folder paths/command inputs have slightly changed. Keeping this as a record. See build-native-image-windows.bat for my current build process (minus vs code script part)
-
Pre req:
- Follow install directions for GraalVM
- I developed this on Windows, which has extra pre-reqs
- GraalVM and Native Image on Windows 10 article
- Follow install directions for GraalVM
- After all the pre-req, I had a hard time finding what exactly would work, what commands to run with what parameters, etc. The exact process character for character that I did is as follows:
- Open CMD as administrator, run the necessary VS code script:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
- replace path with wherever your bat file is located
- Starting in project root:
.\gradlew clean build
cd build\libs
mkdir META-INF\native-image
-
java -agentlib:native-image-agent=config-output-dir=META-INF\native-image -jar mal-cli-1.0-SNAPSHOT-all.jar
- 10-05-22: it is beneficial to run the application with several other inputs as well as specify
config-merge-dir
instead ofconfig-output-dir
, see build-native-image-windows.bat for examples and #15 for explanation
- 10-05-22: it is beneficial to run the application with several other inputs as well as specify
-
native-image --no-fallback --report-unsupported-elements-at-runtime -H:ConfigurationFileDirectories=META-INF\native-image -jar mal-cli-1.0-SNAPSHOT-all.jar mal --enable-url-protocols=https --no-server
- Specifying the config directory
META-INF\native-image
was crucial for me, I saw some examples online statingMETA-INF\native-image
was automatically seen/pulled in when usingnative-image
, but it didn't work for me. Likely user error :P
- Specifying the config directory
- run the cli!
mal
- After this process,
.\build\libs\mal.exe
should be present, from here I just copied it out as this build folder is constantly overwritten by gradle -
I may potentially write a script to automate this whole process, would be fairly specific to this application as I have several flags I am using for thealready wrote onenative-image
calls and what not -
tl;dr for Windows
- open cmd as admin
- run VS code script
- run
build-native-image-windows.bat
- if all goes well, exe file present in
.\native-image-result
- Open CMD as administrator, run the necessary VS code script: