'How do I configure the java.home in a agent of a hudson server?

I am using a windows box to run the agent for my husdon. But I haven't found any effect way to configure JAVA_HOME and PATH for java on the box.

Does anyone know how I am able to do this?



Solution 1:[1]

You can update your Jenkins version, it will solve it. Otherwise this worked for me (Jenkins 1.6, build/test node: MacOSX Mojave):

First install java 8 in your build/test node using the commands:

brew update
brew cask install caskroom/versions/java8

Then in Jenkins web panel click on your build/test node, then click on Configure and then click in the Advanced... button, this will show you multiple text fields. Then in the JavaPath field add the path to your java 8.

enter image description here

For me this path is like:

/Library/Java/JavaVirtualMachines/jdk1.8.X_XXX.jdk/Contents/Home/bin/java

Note: remember replace X_XXX with your java 8 version before.

Then Save.

After that disconnect the build/test node and connect it again. This should solve the problem.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pedro Trujillo