Hi, I am trying to install a tentacle on a machine to deploy Java JARs, but it doesn’t have a JRE “installed” - mainly because there are different (old) versions of the JDK for different applications and thus don’t have a “global” version on our path.
We’re getting this error when we deploy:
“Failed to run java. You must have Java 1.8 or later installed on the target machine, and have the java executable on the path or have the JAVA_HOME environment variable defined”
Is there a way to configure a custom value of JAVA_HOME for just the tentacle or the project, and point this to some JRE8+ unzipped to a specific directory?
I don’t want to set this as a system-wide environment variable otherwise it might interfere with the aforementioned processes.
PS I have toyed with the idea of running the tentacle as a specific user, and setting JAVA_HOME for just that user. But logging into the host as that user to set the variables, or hacking them in via the registry, isn’t possible right now (company policies).
Good question! While there isn’t anything built directly into Octopus that would support what you’re trying to do, you could try running some Powershell before the deployment that would set the variable for the session the tentacle is using.
Your idea of running the tentacle as a specified user and setting JAVA_HOME for just that user may be the best/only way forward with this.
The correct place depends on which step you are using for the java deployment. You may be able to use our Run A Script step and use it on a pre-deploy script.