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
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"
Following steps solved the issue for me..
Copied the zip file into the Program Files folder and extracted to "apache-maven-3.6.3-bin".
Then copied the path, C:\Program Files\apache-maven-3.6.3-bin\apache-maven-3.6.3
Then created the new MAVEN_HOME variable within environmental variables with the above path.
Also added,
C:\Program Files\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin
address to the "PATH" variable
I was able to solve this problem with these steps:
The SETX
command does not modify the current environment.
If you run the following batch file:
setx AAA aaa
echo AAA=%AAA%
It will print
AAA=
So your batch file is wrong. You have to use set
:
set AAA=aaa
See What is the difference between SETX and SET in environment variables in Windows.
I had the same problem on Windows 7.
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
The solution turned out to be very simple - right click on command prompt shortcut and choose "Run as Administrator". After that, the problem disappeared)
In case of windows if there is any space in path to jdk like ("C:\Program Files\jdk") then it doesn't work, but if we keep jdk in a location which doesn't have space then it works fine like ("C:\jdk")