Search code examples
javaintellij-ideagraalvm

Build / Run your application using GraalVM JDK


I am trying to use GraalVM JDK to build my app. I added GraalVM JDK in "Platform Settings > SDKs" selected that and click on OK.

enter image description here

When I build my project I can see that it is still using different executable of "java".

/../_sandbox/lib/jdk8.0.222/bin/java -Dmaven.multiModuleProjectDirectory=/../Desktop/_sandbox/someproject "-Dmaven.home=/../Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.7142.36/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3" -Didea.modules.paths.file=/../Library/Caches/IntelliJIdea2019.2/Maven/idea-projects-state-3333fba9.properties -Dclassworlds.conf=/private/var/folders/2g/9fxnhqts6qsf_h81cnbts8tc0000gn/T/idea-7-mvn.conf "-Dmaven.ext.class.path=/../Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.7142.36/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-event-listener.jar" "-javaagent:/../Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.7142.36/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=49971:/../Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.7142.36/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/../Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.7142.36/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar" org.codehaus.classworlds.Launcher -Didea.version2019.2.4 clean install
Picked up JAVA_TOOL_OPTIONS: -Duser.timezone=Etc/UTC -XX:+UseJVMCICompiler
Unrecognized VM option 'UseJVMCICompiler'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I am using "-XX:+UseJVMCICompiler" flag on GraalVM and because normal JDK1.8 doesn't support that flag I am getting an error.

I expected java path would be /../_sandbox/lib/graalvm-ce-java8-19.3.0/Contents/Home/bin/java if


Solution

  • You need to change Project and Module SDKs to GraalVM as well.

    1

    2

    Also make sure this setting is enabled:

    3