I have created an installer with NSIS for my java app, which works fine. I wanted to add the run option tick box at the end of the installer. The app is launched with a .bat
file.
After a few googles a added this to my NSIS script:
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_FINISHPAGE_RUN "$INSTDIR\path\to\myApp.bat"
!define MUI_FINISHPAGE_RUN_TEXT "Run My App"
!insertmacro MUI_PAGE_FINISH
I got the error Windows cannot find 'javaw'. Make sure you've typed the name correctly, then try again
and according to this the javaw path needs to be set, but I am launching a bat which in turn calls javaw
. Yet when I simply manually run the .bat it works fine.
Is there a way to set the java path in the NSIS installer without having to edit the .bat itself?
Why would having a batch file between the installer and javaw help? %Path% and other environment variables are inherited from the parent process.
I don't know if you are updating the registry and sending WM_WININICHANGE but if you need to start a child process with a updated environment then you also need to update the installer process directly:
System::Call 'KERNEL32::SetEnvironmentVariable(t "name", t "value")i.r0' ; $0 is 0 on error...