Problem:
I get the Maven error "JAVA_HOME environment variable is not defined correctly" when I start Inno batch execution. However, I can successfully work outside of Inno Setup (e.g. Command line, Batch file, Vbs). I do not know how to do that.
Inno Setup Invoked Prompt:
C:\>mvn -version 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
Regular command line:
C:\>mvn -version C:\ Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T01:09:06+05:30) Maven home: C:\Program Files\apache-maven-3.5.0\bin\.. Java version: 1.8.0_131, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_131\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Maven Team from InnoSetup:
[Files] Source: "C:\@Setup\MavenInstaller.bat"; DestDir: "{tmp}"; Flags: ignoreversion [Run] Filename: "{cmd}"; Parameters: "/C ""{tmp}\MavenInstaller.bat"""
Maven command from a batch file:
mvn archetype:generate -DgroupId=com.mycompany.mycomponent-DartifactId=%APPLICATION_NAME% -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
JAVA_HOME setting
Check if Java 1.8 is installed or not. If it is not installed, install it and install JAVA HOME as follows.
SETX JAVA_HOME "C:\Program Files\Java\jdk1.8.0_131" SETX -m JAVA_HOME "C:\Program Files\Java\jdk1.8.0_131" REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v Path /t REG_SZ /d "%path%;C:\Program Files\Java\jdk1.8.0_131\bin;" /f
Thank you very much.
source share