Hi,
I have yet another problem with my installer (posted in a thread right below this): Even though I set the ANT_HOME variable at the beginning of my main section, the installer claims ANT_HOME is invalid when I try to execute an ANT command toward the end of my main section. Here is my code snippet:
SetOutPath $INSTDIR
SetOverwrite on
File /r caTissueCore1.2\*
WriteRegStr HKLM "${REGKEY}\Components" Main 1
${if} $antHomeDir == ''
!insertmacro ZIPDLL_EXTRACT "$EXEDIR\apache-ant-1.6.0-bin.zip" "C:\" "<ALL>"
Strcpy $antHomeDir "C:\apache-ant-1.6.0"
${endif}
${if} $jboss.home.dir == ''
!insertmacro ZIPDLL_EXTRACT "$EXEDIR\jboss-4.0.0.zip" "C:\" "<ALL>"
Strcpy $jboss.home.dir "C:\JBoss-4.0.0"
${endif}
Push $antHomeDir\bin
Call AddToPath
Push JBOSS_HOME
Push $jboss.home.dir
Call WriteEnvStr
Push ANT_HOME
Push $antHomeDir
Call WriteEnvStr
call editCaTissueInstall.Properties
call editSqlConfigFiles
call editTextFilesAndLogo
StrCpy $mySQLEXE "$mySQLEXEbin\mysql.exe"
detailPrint "cmd /C $mySQLEXE -uroot -popen123 < $databaseConfigFile"
nsExec::ExecToLog 'cmd /C IF 1==1 "$mySQLEXE" -uroot -p$databaseLoginPass < $databaseConfigFile'
nsExec::ExecToLog 'cmd /C cd $INSTDIR'
nsExec::ExecToLog 'cmd /C $antHomeDir\bin\ant -f deploy.xml deploy_all_with_config'
Any help would be greatly appreciated.
Thanks!
ANT_HOME Problem
6 posts
You mean it is saying that the ANT_HOME environment variable does not exist?
Stu
Stu
The exact error I am getting is: "ANT_HOME is set incorrectly or Ant could not be located. Please set ANT_HOME."
I know that the ANT_HOME variable is getting set correctly, becuase I have checked it in System > Advanced > Environmental Variables as soon as the installer finishes. Also, if I try running the installer again after the first run fails, it works perfectly. Could it be that I have to restart the computer for the changed environmental variable settings to take effect?
I know that the ANT_HOME variable is getting set correctly, becuase I have checked it in System > Advanced > Environmental Variables as soon as the installer finishes. Also, if I try running the installer again after the first run fails, it works perfectly. Could it be that I have to restart the computer for the changed environmental variable settings to take effect?
Setting the environment variables only works for new processes started from explorer. To set it to new processed started from your process, you need to manually update the environment variables of your process.
Use:
Use:
Ok, I edited my main section with the code in the link you provided, but I am still getting the invalid ANT_HOME error. Here's the edited code:
Section -Main SEC0000Am I doing anything wrong?
SetOutPath $INSTDIR
SetOverwrite on
File /r caTissueCore1.2\*
WriteRegStr HKLM "${REGKEY}\Components" Main 1
${if} $antHomeDir == ''
!insertmacro ZIPDLL_EXTRACT "$EXEDIR\apache-ant-1.6.0-bin.zip" "C:\" "<ALL>"
Strcpy $antHomeDir "C:\apache-ant-1.6.0"
${endif}
${if} $jboss.home.dir == ''
!insertmacro ZIPDLL_EXTRACT "$EXEDIR\jboss-4.0.0.zip" "C:\" "<ALL>"
Strcpy $jboss.home.dir "C:\JBoss-4.0.0"
${endif}
Push $antHomeDir\bin
Call AddToPath
ReadEnvStr $R0 "PATH"
StrCpy $R0 "$R0;$antHomeDir\bin"
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2'
Push JBOSS_HOME
Push $jboss.home.dir
Call WriteEnvStr
Push ANT_HOME
Push $antHomeDir
Call WriteEnvStr
ReadEnvStr $R0 "ANT_HOME"
StrCpy $R0 "$antHomeDir\bin"
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2'
call editCaTissueInstall.Properties
call editSqlConfigFiles
call editTextFilesAndLogo
StrCpy $mySQLEXE "$mySQLEXEbin\mysql.exe"
detailPrint "cmd /C $mySQLEXE -uroot -popen123 < $databaseConfigFile"
nsExec::ExecToLog 'cmd /C IF 1==1 "$mySQLEXE" -uroot -p$databaseLoginPass < $databaseConfigFile'
nsExec::ExecToLog 'cmd /C cd $INSTDIR'
nsExec::ExecToLog 'cmd /C $antHomeDir\bin\ant -f deploy.xml deploy_all_with_config'
SectionEnd
Nevermind, I made a stupid syntax error in the code above and everything works perfectly now. Thanks for all your help!