Notices: This section not yet converted to new layout. Download stats are rolling back out.

Java Platform (JDK)

Package test results have failed.

This package is unlisted and hidden from package listings.

This package was approved by moderator ferventcoder on 8/18/2016.

Java Development Kit. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.


  • tools\chocolateyInstall.ps1 Show
    $script_path = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
    $common = $(Join-Path $script_path "common.ps1")
    . $common
    #    $params = "$env:chocolateyPackageParameters" # -params '"x64=false;path=c:\\java\\jdk"'
    #    $params = (ConvertFrom-StringData $params.Replace(";", "`n")) 
    if (checkIfInstalled)
        Write-Host "JDK $java_version already installed."
    # Download JDK file and store locally
    $arch = get-arch
    $jdk_file = download-jdk
    $java_home = get-java-home
    $checksum = get-checksum
    $checksumType = 'sha256';
    # Install JDK
    Write-Host "Installing JDK $jdk_version($arch) to $java_home"
    Install-ChocolateyInstallPackage $package 'exe' "/s" $jdk_file -ChecksumType "$checksumType" -Checksum "$checksum"          
    Write-Host "Completed Installing JDK $jdk_version($arch) to $java_home"
    # Add java bin folder to Path
    $java_bin = get-java-bin
    Write-Host "Adding $java_bin to the Path"    
    Install-ChocolateyPath $java_bin 'Machine' 
    Write-Host "Completed Adding $java_bin to the Path"	
    # Add CLASSPATH environment variable if it doesn't exist
    if ([Environment]::GetEnvironmentVariable('CLASSPATH','Machine') -eq $null) {
        Write-Host "Adding CLASSPATH Environment Variable"    
        Install-ChocolateyEnvironmentVariable 'CLASSPATH' '.;' 'Machine'
        Write-Host "Completed Adding CLASSPATH Environment Variable"    
    # Add JAVA_HOME environment variable if it doesn't exist
    if ([Environment]::GetEnvironmentVariable('JAVA_HOME','Machine') -eq $null) {
        Write-Host "Adding JAVA_HOME Environment Variable"    
        Install-ChocolateyEnvironmentVariable 'JAVA_HOME' $java_home 'Machine'
        Write-Host "Completed Adding JAVA_HOME Environment Variable"    
  • tools\chocolateyuninstall.ps1 Show
    $script_path = $(Split-Path -parent $MyInvocation.MyCommand.Definition)
    $common = $(Join-Path $script_path "common.ps1")
    . $common
    # Function to remove a value from the Machine Environment Variable path value
    function Uninstall-ChocolateyPath {
      [string] $pathToUninstall,
      [System.EnvironmentVariableTarget] $pathType = [System.EnvironmentVariableTarget]::User
      Write-Debug "Running 'Uninstall-ChocolateyPath' with pathToUninstall:`'$pathToUninstall`'";
      #get the PATH variable
      $envPath = $env:PATH
      if ($envPath.ToLower().Contains($pathToUninstall.ToLower()))
        Write-Host "Starting PATH environment variable update to remove $pathToUninstall"
        $actualPath = [Environment]::GetEnvironmentVariable('Path', $pathType)
        $statementTerminator = ";"
        $actualPath = (($actualPath -split $statementTerminator) -ne $pathToUninstall) -join $statementTerminator
        if ($pathType -eq [System.EnvironmentVariableTarget]::Machine) {
          $psArgs = "[Environment]::SetEnvironmentVariable('Path',`'$actualPath`', `'$pathType`')"
          Start-ChocolateyProcessAsAdmin "$psArgs"
        } else {
          [Environment]::SetEnvironmentVariable('Path', $actualPath, $pathType)
        $env:Path = $actualPath
    	Write-Host "Completed PATH environment variable update to remove $pathToUninstall"
    # Helper function to figure out the GUID to use with msiexec to uninstall JDK and JRE versions that are installed for this package
    # The GUID changes depending on if OS is x64 or i386
    function Uninstall-JDK-And-JRE {
        $use64bit = use64bit
        if ($use64bit) {
            # HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{64A3A4F4-B792-11D6-A78A-00B0D0170720}
            $jdk = " /qn /x {64A3A4F4-B792-11D6-A78A-00B0D0" + $uninstall_id + "0}"       
            # HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{26A24AE4-039D-4CA4-87B4-2F06417072FF}
            $jre = " /qn /x {26A24AE4-039D-4CA4-87B4-2F064" + $uninstall_id + "FF}"   
        } else {
            $jdk = " /qn /x {32A3A4F4-B792-11D6-A78A-00B0D0" + $uninstall_id + "0}"
            $jre = " /qn /x {26A24AE4-039D-4CA4-87B4-2F832" + $uninstall_id + "FF}"   
         Write-Host "Uninstalling JDK"
         Start-ChocolateyProcessAsAdmin $jdk 'msiexec'
         Write-Host "Completed Uninstalling JDK"
         Write-Host "Uninstalling JRE"
         Start-ChocolateyProcessAsAdmin $jre 'msiexec'
         Write-Host "Completed Uninstalling JRE"
    # Uninstall JRE and JDK
    # Remove java-bin from the Environment path
    $java_bin = get-java-bin  
    Uninstall-ChocolateyPath $java_bin 'Machine'
    # If CLASSPATH environment variable exist, make it null
    if ([Environment]::GetEnvironmentVariable('CLASSPATH','Machine') -eq '.;') {
      Write-Host "Uninstalled Machine Environment Variable 'CLASSPATH'"
      Install-ChocolateyEnvironmentVariable 'CLASSPATH' $null 'Machine'
    # If JAVA_HOME environment variable equal to this version of the JDK, make it null
    if ([Environment]::GetEnvironmentVariable('JAVA_HOME','Machine') -eq "$java_home") {
      Write-Host "Making Machine Environment Variable 'JAVA_HOME' blank"
      Install-ChocolateyEnvironmentVariable 'JAVA_HOME' $null 'Machine'
      Write-Host "Completed Making Machine Environment Variable 'JAVA_HOME' blank"
  • tools\common.ps1 Show
    $package = 'jdk7'
    $build = '15'
    $jdk_version = '7u79' 
    $java_version = "1.7.0_79"
    $uninstall_id = "17079" 
    $checksumX64  = '80B1452C808691DC63945926C52156C8AFE7EBCFA3747093FD296F0A3F1CFBCC'
    $checksumX32 = '658643EF2775E015449409B844AF4FDB087F51921B61E5DD02DAC62A43C956F2'
    $checksumType = 'sha256'
    # Check if OS is 32 bit or 64 Bit
    function use64bit() {
        $is64bitOS = (Get-WmiObject -Class Win32_ComputerSystem).SystemType -match '(x64)'
        return $is64bitOS
    # Check if a file exist or not
    function has_file($filename) {
        return Test-Path $filename
    # Get the Program Files Directory
    function get-programfilesdir() {
        $programFiles = (Get-Item "Env:ProgramFiles").Value
        return $programFiles
    # Check if JDK Version is already installed or not
    function checkIfInstalled()
        $jdkPath = "HKLM:\SOFTWARE\JavaSoft\Java Development Kit"
        if (Test-Path -Path $jdkPath)
            $installedJdkVersion = dir $jdkPath | select -expa pschildname -Last 1
    		Write-Debug "Installed JDK Version: $installedJdkVersion"
    		$isInstalled = $installedJdkVersion -eq  $java_version	
    		Write-Debug "Jdk IsInstalled: $isInstalled"
    		return $isinstalled
    	Write-Debug "Jdk Is Not Installed"
    	return $false    
    # Helper function to properly download a given JDK version from Oracle
    # Key for this to work is to set the Header Cookie Information
    # Will only if it doesn't already exist on the local system
    function download-from-oracle($url, $output_filename) {
        if (-not (has_file($output_fileName))) {
            Write-Host  "Downloading JDK from $url"
            [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
            $client = New-Object Net.WebClient
            $client.Proxy = [System.Net.WebRequest]::DefaultWebProxy
            $client.Headers.Add('Cookie', 'gpw_e24=; oraclelicense=accept-securebackup-cookie')
            $client.DownloadFile($url, $output_filename)
            [System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null 
            Write-Host  "Completed Downloading JDK from $url"
    # Download the JDK version that we need.
    function download-jdk() {
        $filename = "jdk-$jdk_version-windows-$arch.exe"
        $url = "$jdk_version-b$build/$filename"
        $output_filename = Join-Path $script_path $filename
        download-from-oracle $url $output_filename
        return $output_filename
    # Figure out where the JAVA_HOME directory is
    function get-java-home() {
        $program_files = get-programfilesdir
        return Join-Path $program_files "Java\jdk$java_version"
    # Figure out where the JAVA_HOME bin directory is
    function get-java-bin() {
        $java_home = get-java-home
        return Join-Path $java_home 'bin'
    # Helper function to figure out the architecture for the oracle download.  
    # Either x64 or i586
    function get-arch() {
        if(use64bit) {
            return "x64"
        } else {
            return "i586"
    function get-checksum() {
        if (use64bit) {
            return $checksumX64
        } else {
            return $checksumX32

Virus Scan Results

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.


This package has no dependencies.

Package Maintainer(s)

Software Author(s)

  • Oracle


Release Notes

Version History

Version Downloads Last updated Status

Discussion for the Java Platform (JDK) Package

Ground rules:

  • This discussion is only about Java Platform (JDK) and the Java Platform (JDK) package. If you have feedback for Chocolatey, please contact the google group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or Java Platform (JDK), or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.

comments powered by Disqus uses cookies to enhance the user experience of the site.