How do I fix maven error The JAVA_HOME environment variable is not defined correctly?

后端 未结 19 1272
误落风尘
误落风尘 2021-02-01 01:33

Issue:

I am getting the Maven error \"The JAVA_HOME environment variable is not defined correctly\" when I run through Inno setup batch execution. Howe

19条回答
  •  情深已故
    2021-02-01 02:13

    I struggled with the same issue, and the following worked for me.

    Step 1: Check your JAVA_HOME setting. It may look something like:

    JAVA_HOME="/usr/libexec/java_home"
    

    Step 2: Update JAVA_HOME like so:

    $ vim .bash_profile 
    
    export JAVA_HOME=$(/usr/libexec/java_home)
    
    $ source .bash_profile
    

    Step 3: In a new shell, check that the Maven command is now working properly:

    $ mvn -version
    

    If this fixed the problem, you should get back a response like:

    Apache Maven 3.0.3 (r1075438; 2011-03-01 01:31:09+0800)
    Maven home: /usr/share/maven
    Java version: 1.7.0_05, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "mac os x", version: "10.8.2", arch: "x86_64", family: "mac"
    

提交回复
热议问题