Wednesday, April 6, 2016

How To Update Oracle Java On Windows 10

When you receive a notification from Windows 10 that a Java update is available from Oracle, it normally means that the latest update to the JRE (Java Runtime Edition) will be applied if you click on the notification notice (or if you invoke Java update from the Control Panel > Programs > Java) to your current JRE.

Note that the JDK (aka SE) will NOT be updated - why this is so is anyone's guess. If you have installed the JDK (else you will NOT receive the notification), then you have to update it manually. This article will show you how to carry out the update.

Assume that you are using the version 1.8.0_74 version of Oracle's Java JDK and you wish to apply the 1.8.0_77 update to it. The term 'update' is a bit misleading here, because you have to download the FULL version of the JDK before installing it to a new directory. You also need to reset the system variable 'JAVA_HOME' and the path to the 'bin' directory of Java to point to the new 1.8.0_77 directory.

Follow the steps below in order the 'update' Oracle Java on Windows 10:

  1. Point you web browser to the site and then click on the 'Download' button for the JDK. Note that the current (as of April 2016) version of Java JDK (aka SE) is 8u77.

    On the next page that appears, you will find a item labelled 'Java SE Development Kit 8u77'. On this item, click on 'Accept License Agreement', and followed by a click on the Windows x64 Java download file. Remember to save the files if a prompt appears - they will go into the 'Downloads' folder by default.

    On the same page (you may have to scroll up a bit), you will find a item labelled 'Java SE Development Kit 8u77 Demos and Sample Downloads'. On this item, click on 'Accept License Agreement', and followed by a click on the Windows x64 Java download file. Remember to save the files if a prompt appears - they will go into the 'Downloads' folder by default. Strictly speaking, this item is not necessary for Android program development but is recommended if you are new to Java and wish to play around with demos and samples provided by Oracle.

  2. Now click the 'Back' button on your web browser and then click on the Java SE 8 Documentation 'Download' button (you may have to scroll up a bit to see this item) to download the API documents for Java. Again this item is not necessary for Android program development but is highly recommended if you are a heavy Java programmer.

    On the next page that appears, click on 'Accept License Agreement', followed by a click on the docs download file. Remember to save the files if a prompt appears - they will go into the 'Downloads' folder by default.

  3. If you take a look in the Downloads folder, you should see the following all three files there. To install the Java JDK 8, double-click on the 'jdk-8u77-windows-x64.exe' file. If you are prompted for a password, supply one. The Java Setup screen will appear.

    From here, follow the on-screen instructions in order to install Java - keep clicking on the 'Next' button when they appear, until you come to the last screen where you can click on the 'Close' button. Oracle Java JDK version 1.8.0_77 is now installed on you PC.

  4. If you have downloaded the demos (and samples) and docs, you can go ahead to install them, if you wish. First unzip the demos to a temporary directory - this will create a 'jdk 1.8.0_77' sub-directory in which there will be two more sub-directories - 'demo' and 'sample'. Then unzip the 'docs' file to the same 'jdk 1.8.0_77' sub-directory just created. This will create another sub-directory called 'docs'. Then move all these 3 sub-directories ('demo', 'docs' and 'samples') to the actual Java directory, i.e., 'C:\Program Files\Java\jdk1.8.0_77'. You will have to give permission for this action since you are moving files into a 'system' type directory.

  5. We also have to reset the JAVA_HOME and the PATH environment variables to include the 'bin' directory of where the new Java was installed on your system. If you have not changed it this would be 'C:\Program Files\Java\jdk1.8.0_77'. To do this, right-click on the 'This PC' icon on your desktop and select 'Properties'. Alternatively, if you have not personalize your desktop and 'This PC' icon is not present on your desktop, launch 'Windows File Explorer', then right-click on the 'This PC' item in the 'File Explorer' and select 'Properties'.

  6. On the screen that appears, click on the 'Advanced system settings' item. On the 'System Properties' window that appears, click on the 'Environment Variables' button.

    The 'Environment Variables' window will appear. Click on the 'JAVA_HOME' variable name then click on the 'Edit...' button. In the 'Edit System Variable' window that appears, change 'C:\Program Files\Java\jdk1.8.0_74' to 'C:\Program Files\Java\jdk1.8.0_77'. Then click the 'OK' button.

  7. If you look at the 'System variables' portion of the window, you see the 'Path' item, then click on it. Click on the 'Edit...' button. The 'Edit environment variable' window will appear. Click on the 'C:\Program Files\Java\jdk1.8.0_74\bin\' item and then click on the 'Edit' button. Change it to to 'C:\Program Files\Java\jdk1.8.0_77\bin\' and press the 'Enter' key. Click 'OK', followed by another 'OK', and finally another 'OK'.

  8. To make the new environment variables effective, log out from the system, then log in again. Open a non-admin command prompt and type the following commands (followed by the 'Enter' key), one by one:

      echo %JAVA_HOME%
      echo %PATH%
      java -version
      javac -version


    If you see the string '1.8.0_77' then you are all set to use the new updated Java JDK. If you wish, you can now delete the 'C:\Program Files\Java\jdk1.8.0_74\' directory to free up some disk space.
That's it - you now have a fully updated Windows 10 PC.