C:\Program Files (x86)\Java\jre1.8.0_171\bin\java.exe
to
C:\Program Files (x86)\Java\jre1.8.0_181\bin\java.exe
I tried simply providing “Java.exe” (which works from a CMD prompt) but AlwaysUp requires the full-path. How can I get AlwaysUp to run the Java.exe in my PATH environment variable?
— Anonymous
Hi. AlwaysUp expects a full path, so I see the problem!
We recommend adding a “layer of indirection” to solve the problem. Please:
Create a new Windows batch file that runs your full java command line. However, instead of specifying the full path to java, simply use java.exe.
When run, the batch file will use whatever java.exe is in your Windows account’s PATH variable.
Here is what our simple batch file (saved to “C:\Tools\start-java-app.bat”) looks like:
Please open a command prompt, run your batch file and confirm that it launches your program (EchoLink Proxy) as you expect.
Update your AlwaysUp entry to run the new batch file. Specify the full path to the batch file in the Application field on the General tab:
Be sure to clear the Arguments field if it contains the parameters for the Java command line! Those should already appear in the batch file.
And on the AlwaysUp Logon tab, specify the Windows account you are logged in to right now. Java must be launched in this account so that it finds the correct PATH environment value.
Finally, update the new batch file to add a 5 second delay at the end. We recommend using the Windows TIMEOUT command, but there are several alternatives:
timeout /t 5
Without this adjustment, the batch file may exit very quickly and fool AlwaysUp into thinking that the batch file failed to start properly.
Save your batch file — and your settings in AlwaysUp.
Now, when you start your modified entry from AlwaysUp, the following will happen:
AlwaysUp will start the batch file
The batch file will launch Java from the PATH, as you have configured
The batch file will “sleep” for 5 seconds
The batch file will exit
AlwaysUp will notice that the batch file has exited and “attach” to the Java.exe child process
AlwaysUp will continue to monitor Java.exe and restart it (via the batch file) if it ever crashes/fails/exits.
Any monitoring, reporting and alerts you have configured should continue to work as they did before.
Please let us know if you run into any trouble implementing this approach!