I'm trying to create a native image from a simple Java program using GraalVM on my Windows 10 machine. The Java program, Hello.java, is a basic "Hello World" print statement.
I followed these steps:
- Created Hello.java with a "Hello World" print statement.
- Compiled it using javac Hello.java, which resulted in a Hello.class file.
- Attempted to create a native image with the command:
native-image Hello
However, I encountered the following error:
Error: On Windows, GraalVM Native Image for JDK 21 requires Visual Studio 2022 version 17.1.0 or later (C/C++ Optimizing Compiler Version 19.31 or later).
Compiler info detected: cl.exe (microsoft, x64, 19.29.30152)
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
I already have Visual Studio Community 2022 installed. What could be causing this error, and how can I resolve it? Are there any specific configurations or additional steps needed to make GraalVM recognize Visual Studio 2022 correctly?
Additional information:
- System variebles/Path/ C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\
- openjdk version "21" 2023-09-19
- OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15)
Access is denied.
complaints (specifically on the addedcall
). Hopefully this works for others. – Linkous