Changing JAVA HOME on Agents

There may be cases where a different version of Java than what the agent was installed with, need to be used. For example, the agents were accidentally installed with version 6, but the product being built needs version 5, so the agents need changed to version 5. Or, another example, a company-wide policy was put in place to use newer versions, so all the agents need to use the new version, respectively. Luckily, there are somewhat easy ways to do this.

Automatic Method (Easiest)

A simple re-install (fake upgrade) of the agent can easily fix this, as running the installer will reconfigure some settings for the agent (for example, a different JAVA_HOME, different agent install path, x86 to x64 architecture on Java, etc.).

  1. Locate the version of the agent you need to install. An easy way to do this would be to look at your current agent's installed.version file.
  2. Download the respective version of the installer from Supportal.
  3. Make a backup of the installed.properties file, just so you have a record of the previous settings.
  4. Extract the agent-installer somewhere, and open up an Administrative Command Prompt.
  5. From the Administrative Command Prompt, navigate to the extracted folder and execute install-agent.bat.
  6. Give the installer the path to the agent.
  7. When prompted to upgrade the agent, input Y.
  8. Give the JAVA_HOME path for the agent (do NOT include the \bin\ directory).
  9. Answer any remaining questions (including information about the Windows Service). You should be able to answer these questions by using your backed up installed.properties file as a template.

After the installation completes (and possibly the Windows Service installation), you should be able to bring your agent back online with the new settings in place.

Manual Method (Hardest)

If a simple reinstall of the agent cannot be done, you can still manually change the settings on the agent to point to the new Java...however this opens up room for human error if not configured correctly.

  1. Navigate to the %AGENT_HOME% directory.
  2. Open up the \bin\ subdirectory.
  3. Edit ah3agent.cmd and change the JAVA_HOME line to the value you need (do NOT include the \bin\ directory).
  4. Edit the classpath.conf file and change the nativedir option if you are changing architectures of Java (x86 vs x64). If not, leave this alone.
  5. Edit the ahptool.cmd file and change JAVA_HOME line to the value you need (do NOT include the \bin\ directory).
  6. Edit the codestation.cmd file and change the JAVA_HOME line to the value you need (do NOT include the \bin\ directory).
  7. Open up the ..\conf\ subdirectory.
  8. Edit the installed.properties file and change the anthill3/java.home setting to the value you need, remembering to escape the string when inputting your path (do NOT include the \bin\ directory).

Windows Service

In addition to all the steps in the previous section, you still need to modify the Windows Service so anthill reads in the correct values from the registry. The following steps need to be performed as well:

  1. (IF IT EXISTS) Open up the %AGENT_HOME\bin\service directory and load the _agent.cmd file. Change the value for JAVA_HOME in here. Also, change the architecture if necessary.
  2. (IF IT EXISTS) Open up the %AGENT_HOME\bin\service directory and load the _ah3agent.cmd file. Change the value for JAVA_HOME in here. Also, change the architecture if necessary.
  3. Open up the %AGENT_HOME\bin\service directory and load the ah3agent.cmd file. Change the value for JAVA_HOME in here. Also, change the architecture if necessary.
  4. From an Administrative Command Prompt, uninstall the current Windows Service for the agent, and re-install it. This is in the documentation under the manual agent installation section