Created
February 10, 2016 22:36
-
-
Save crmckenzie/4d8bc2ca257de8999c9e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Install-Java7JRE() | |
{ | |
# 7.0.79 | |
$url = "http://javadl.sun.com/webapps/download/AutoDL?BundleId=106369" | |
$filename = "jre-7u79-windows-x64.exe" | |
$downloadedFile = Join-Path $env:TEMP $filename | |
$javaHome = Join-Path $env:ProgramFiles "Java\jre7" | |
$jreForPathVariable = Join-Path $javaHome 'bin' | |
if ((Test-Path -Path $downloadedFile) -eq $acfalse) | |
{ | |
Invoke-WebRequest -Uri $url -OutFile $downloadedFile | |
} | |
$process = Start-Process -FilePath $downloadedFile ` | |
-ArgumentList /s ` | |
-NoNewWindow -Wait | |
[Environment]::SetEnvironmentVariable('JAVA_HOME', $javaHome, 'Machine') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment