Search code examples
javagraalvm

GraalVm: Failed to find 'vcvarsall.bat' in a Visual Studio installation


I'm using GraalVM and trying to make exe file from jar file, but it said:

Error: Failed to find 'vcvarsall.bat' in a Visual Studio installation. Please make sure that Visual Studio 2022 version 17.1.0 or later is installed on your system. You can download it at https://visualstudio.microsoft.com/downloads/. If this error persists, please try and run GraalVM Native Image in an x64 Native Tools Command Prompt or file a ticket.

In GraalVM docs, it said that I have to install MSVC, Windows 10 SDK, CMake, Testing tool,... I installed all of them except my SDK is Windows 11 SDK but I think it should have been compatible with Windows 10 SDK.

Does anyone know how to fix it?

Thank you.

My Visual Studio Installer


Solution

  • I also installed D and encountered the error: Unable to find vcvarsall.bat. After some research, I found this article that suggested the issue might be related to environment variables: How I Solved Error: Unable to Find vcvarsall.bat.

    To resolve this, I modified the native-image.cmd file by adding the following lines:

    cmd:

    @echo off
    call "D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" > null
    

    This modification successfully fixed the issue for me. I hope this solution helps anyone else facing the same problem.

    Note: the native-image.cmd file is located inside the <graalvm-jdk-home>\bin