3

I am using a windows box to run the slave 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?

Winston Chen
  • 6,393
  • 11
  • 47
  • 78

2 Answers2

8

You can configure where Jenkins/Hudson should search for the JDK on the slave on the slave configuration page.

Check "Tool Locations", Click "Add", select the JDK from the List and type the path to the JDK in the "Home" text field below.

If JDK isn't showing up in the Tool Locations list, it may be because you need to configure a JDK globally first. To do this, check the "JDK" section in your global configuration page.

ArtOfWarfare
  • 17,763
  • 14
  • 122
  • 177
Joachim Sauer
  • 278,207
  • 54
  • 523
  • 586
  • +1 This working a seldom built project, then it just stopped - suspect somebody changed the global setting. Setting the JDK in the project might be more robust that setting as global. – earcam Dec 20 '12 at 17:52
  • @Joachim Sauer - I don't see JDK in the list of tools I can add locations for. I see Git, WindowsGit, Maven, and SonarRunner. How can I make JDK appear? – ArtOfWarfare Jul 11 '13 at 13:30
  • Finally got it to appear in the list... I'm realizing the original answer actually contained what I needed to know but I overlooked it. I'm editing the answer to make it clearer. – ArtOfWarfare Jul 11 '13 at 14:04
  • Awesome, thanks! The german translation of the page makes it even harder to find the setting. – Stephan Dec 09 '14 at 07:58
0

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.

Pedro Trujillo
  • 916
  • 12
  • 13