Friday, January 23, 2015

Upgrading Oracle JDK 8 on Windows

It was interesting to note that Oracle has just issued updates to their Java. What was NOT interesting to note, however, they STILL have not updated their documentations on HOW, exactly, does one goes about upgrading their present Java installation to their latest version. All I could find was instructions on INSTALLING their Java package and I searched their documentation very closely. Maybe I missed something but I swear that this is unbecoming of a major software vendor. What is wrong (and how much effort will it take) with issuing a simple note on how to upgrade their existing installation?

This article is specifically written to overcome the shortcoming of Oracle, and is targeted towards the Windows (specifically 7, 8 and 8.1) users of Oracle Java SE (or JDK) 8. It was written for users of Oracle JDK 8 Update 25 who wants to upgrade to Oracle JDK 8 Update 31 - the 64 bit version. With a little tweaking, it can also be used to update the 32 bit version as well.

I will assume that the user has installed Oracle's JDK 8 by following the instructions in my previous blog, which can be found here.

STEP 1: Point your web browser to Oracle's download site here and download the following files:


STEP 2: Double-click on the '.exe' file and follow the on screen instructions to install the JDK. Note that the previous version of the JDK (1.8.0_25 in this case) is still present on your system - just in case if you still want this - if not, you can go ahead and uninstall it using the Control Panel later.
If you have downloaded the demos (and samples) and docs, now would be a good time to install them. First unzip the demos to a temporary directory - this will create a 'jdk 1.8.0_31' 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_31' 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_31'. You will have to give permission for this action since you are moving files into a 'system' type directory.

Next we have to edit the JAVA_HOME system variable. To do this, right-click on the 'This PC' icon on your desktop and select 'Properties'. On the next 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 item. Then click on the 'Edit...' button and change the '1.8.0_25' to '1.8.0_31'. Then click the 'OK' button.

Scroll down the 'System variables' window until you see the 'Path' item, then click on it. Then click on the 'Edit...' button. The 'Edit System Variable' window will appear. Click anywhere in the 'Variable value' field and then press the End key on your PC. Then edit the last item and change the '1.8.0_25' to '1.8.0_31'. Click on OK, followed by another OK and lastly by another OK to close the System Properties window. Then close the System window.

To make the new environment variables effective, log out from the system, then log in again. Open a Command Prompt and type the following commands:

  java -version

  javac -version
  echo %JAVA_HOME%
  echo %PATH%

If the output contains the string "1.8.0_31", then the update was successful. Now you can uninstall the old JDK using the Control Panel.

That's it - you are now using the updated Java. Happy computing!

No comments:

Post a Comment