Skip to content
Advertisement

Cannot compile simple “Hello World” Java application with native-image on Windows

I’m trying to compile a simple Java Hello World application to native code using the native-image utility provided by GraalVM on Windows but I always run into errors (see below).

HelloWorld.java:

JavaScript

First, I compile the code to a class file using the following command:

JavaScript

Next, I invoke the native-image command from the VS 2017 Developer Command Prompt:

JavaScript

I also tried the Windows SDK 7.1 Command Prompt and the VS 2019 version but neither worked. How can this issue be fixed? It can’t be the compiler since it works for regular C/C++ applications. Is there anything else you need to configure for this?

Advertisement

Answer

I managed to compile successfully using JDK 11 and the respective version of GraalVM. A visual guide for this can e.g. be found here (note: I’m the video uploader).

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement