Setting Windows JAVA_HOME Environment Variable to just the Java jdk folder (not the exe)


1 comment

  • Avatar

    If you are using the <autodetectjava>, it will define the variable ${java_executable}. Using that, you can get java_home as:

    <dirName path="${java_executable}" variable="java_bin_dir"/>
    <dirName path="${java_bin_dir}" variable="java_home"/>

    And then set the environment variable:

    <addEnvironmentVariable name="JAVA_HOME" value="${java_home}"/>

Please sign in to leave a comment.