Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # IT:AD:Java:HowTo:Install # <callout type="Navigation" class="small"> * [[../|(UP)]] * See also: * [[IT/AD/Powershell/HowTo/Snippets/Work with Environment Variables]] * [[IT/AD/PowerShell/HowTo/Snippets/Refresh Environment Variables]] * [[IT/AD/Environment Variables/HowTo/Tips Regarding PATH]] </callout> <panel title="Summary"> </panel> ## Process ## #### 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: <sxh> c:\Program Files (x86)\Java\Current\ </sxh> When it's finished installing I do *copy* the dir to a folder that lists the version. <sxh> c:\Program Files (x86)\Java\vxxxx\ </sxh> 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 #### <wrap tip> 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... </wrap> #### 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: <sxh> # As An Administrator, due to /m switch: SETX JAVA_HOME "C:\Program Files (x86)\Java\Current" /m </sxh> #### 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*: <sxh> C:\ProgramData\Oracle\Java\javapath; </sxh> 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: <sxh> `%JAVA_HOME%\bin\` </sxh> As per [[IT/AD/Powershell/HowTo/Snippets/Work with Environment Variables]]: <sxh powershell> 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; } </sxh> #### Check the Installation As per [[IT/AD/Java/HowTo/Check that Java is correctly installed]]: <sxh> java -version </sxh> /home/skysigal/public_html/data/pages/it/ad/java/howto/install.txt Last modified: 2023/11/04 01:46by 127.0.0.1