it:ad:java:howto:install

IT:AD:Java:HowTo:Install

Download the Right Version

Consider downloading and using the Java 32 bit version from: * https://java.com/en/download/manual.jsp

  • Note:I know 64 is hot – but IT:AD:Jenkins and others rely on the 32 bit version.

Install it to the right directory.

Personally, I override the default installation location and set it to:

c:\Program Files (x86)\Java\Current\

When it's finished installing I do copy the dir to a folder that lists the version.

c:\Program Files (x86)\Java\vxxxx\

The reason I do this is so that I don't have to update all the various places that might point to it, such as the PATH variable (see below).

Know something about Environment Variables First

You'll be surprised by how tricky setting a Service Account's Environment Variables can get: * IT:AD:Environment Variables:HowTo:Tips Regarding PATH Notice especially the unintuitive nature of setting Local User Environment Variables…

Set the JAVA_HOME Environment Variable

A huge amount of Java applications originally designed for Linux environments rely on finding the JAVA_HOME System IT:AD:Environment Variables

Set it from the command line:

# As An Administrator, due to /m switch:
SETX JAVA_HOME "C:\Program Files (x86)\Java\Current" /m

PATH

Ensure the path to the Bin directory is in the PATH IT:AD:Environment Variables.

You may find that there is already something like the following within the System PATH:

C:\ProgramData\Oracle\Java\javapath;

which indirectly points back to C:\Program Files (x86)\Java\Current\java.exe

But if it's not there, since you just defined JAVA_HOME, you can Append to PATH the following:

`%JAVA_HOME%\bin\`

As per IT:AD:Powershell:HowTo:Snippets:Work with Environment Variables:

function AddPathToPATHEnvironmentVariable([string]$path, [string]$pattern, [string]$scope="Machine"){
  if (!$pattern){
	$pattern = $path;
  }
  if (!$Env:path.ToLower().Contains($pattern.ToLower()))
  {
    $tmpPath = [Environment]:: GetEnvironmentVariable("Path",$scope);
    [Environment]:: SetEnvironmentVariable("Path", $tmpPath + ";"+ $path, $scope)
	return $true;
  }
  return $false;
}

Check the Installation

  • /home/skysigal/public_html/data/pages/it/ad/java/howto/install.txt
  • Last modified: 2023/11/04 01:46
  • by 127.0.0.1