Share via

How to set JDK path used by dotnet build command

Simon Näf 0 Reputation points
2024-04-29T07:00:01.4566667+00:00

Hello,

We build our .NET MAUI app for android using the dotnet publish command on the command line. During the build, the wrong version of the JDK (Java Development Kit) gets picked.

How can we specify the path to the JDK that should be used for the build?

We already tried setting the JAVA_HOME environment variable but without success. We are running the build on macOS.

Thank you for your help.

Developer technologies | .NET | .NET Multi-platform App UI

1 answer

Sort by: Most helpful
  1. Simon Näf 0 Reputation points
    2024-04-29T14:51:17.85+00:00

    I found the answer myself:

    To set a custom JDK path for the command, you can use a environment variable named JavaSdkDirectory

    that contains the JDK directory path.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.