Java uninstall all versions

How to Uninstall Java for Windows 10

We will look at how to uninstall and remove Java completely from a Windows 10 system through tools. Invented by James Gosling, Java is an extremely popular, object-oriented programming language. The first version came out in 1996. Since then, there have been many versions of Java released. In this article, we will learn why and how to uninstall older versions of Java from a Windows 10 system.

1. Introduction

A new version of Java comes roughly every 6 months (prior to Java 8, this cycle was about 2-3 years). The newer versions contain fixes for issues in the earlier version, newer features, classes, and packages. Oracle recommends upgrading to the newer versions and uninstalling the older one.

1.1 Why should I uninstall Java versions which are old?

Before we see the steps to uninstall, we will first understand why keeping and using older versions of Java is dangerous.

We highly recommend that you uninstall all older versions of Java from your system.
Keeping old versions of Java on your system presents a serious security risk.
Uninstalling older versions of Java from your system ensures that Java applications will run with the latest security and performance improvements on your system. Oracle on Java.com

Every new Java version releases fixes related to security and bugs from the older version. Using an older version of Java poses serious security threats. Flashback which affected Apple Macs is the most dramatic example of the security threat of old Java versions.

2. Why does Java not Uninstall the older version when I upgrade?

Java lets you install more than one version of Java on a system. The user can choose which version to run their Java application with. So, Java itself does not uninstall the earlier versions while upgrading. However, Oracle does not recommend this as it leaves your system open to security leaks.

2.1 Why would I need to run multiple versions of Java?

  • Java generally provides back-compatibility i.e. all the features that worked in the earlier version will work in the same way in the next version as well.
  • However, at times, some features of java do not work the same way as the older version due to changes in the code.
  • Also, some features may be deprecated in the newer version of Java. Example: Applets were deprecated in Java 9 and later removed from Java 11 onwards. So, if we have an application that relies on these deprecated/removed features, we will require an older version of Java.
  • In some cases, some legacy applications specify that they require a certain version of Java to run. In this case, as well we would require an older version.
Читайте также:  Код символа html рубль

3. How do I check which Java versions are installed on my system?

We can check the installed Java versions using 2 methods.

3.1 In the Program Files

  • Open the Windows Explorer.
  • Navigate to the path: C:/Program Files OR C:/Program Filesx86
  • Check for the folder named: Java.
  • In this folder, you will see the Java Development Kit (JDK) and/or Java Runtime Environment (JRE) installed on your system including the version numbers. For example I have Java version 7 ( jdk1.7.0_80 ), Java version 8 ( jre1.8.0_261 ), Java version 11 ( jdk-11.0.8 ) an Java version 14 ( jdk-14.0.2 ) installed on my system.

Uninstall Java - Installed java versions in program files

3.2 Using the “where” command

  • Open the Command Prompt by typing cmd in the “Type here to search” box and click on the first option.
  • Another way is to press the Windows icon + R on the keyboard to open run and then type cmd .
  • Then type in where command. This will show the path all the different versions of java executables present in the system. (They need to be added to the classpath)

Uninstall Java - output of the where command

4. How do I uninstall the Older versions of Java?

There are 3 methods with which we can uninstall Java on our system.

4.1 Using the Java uninstall tool

Oracle provides the Java uninstall tool for removing Older versions of Java in the system. Go to the page, accept the Terms and download the JavaUninstallTool.exe file. Once downloaded we need to run it and follow the steps in the tool. The output should be similar to the image.

java uninstall tool steps

4.2 Uninstall through the Control Panel

  1. In the search box type “Programs”.
  2. Select the “Add or remove programs” option. This opens the path
  3. In the Search List, type Java. This should show you all the Java versions installed on the System.
  4. Click on the uninstall button for the version you want to uninstall.

Uninstall a Java version using the Control Panel

4.3 OpenJDK uninstall

For uninstalling OpenJDK java installs, simply delete the extracted folder for Java.

5. How to remove Java completely from my system?

To remove all versions of Java installed on the system, repeat the steps for “Uninstall Java through the Control Panel.” That we have seen for removing older versions of Java. Repeat the steps for every installed version of Java. Example: On my system I would have to repeat twice because there are 2 versions Java version 11 and Java version 14 installed on my system.

If the Java versions installed are OpenJDK versions, delete the extracted folders.

Читайте также:  Display text on top css

6. Clearing the PATH variable

  1. In the type box, type “Environment Variables” and select the first option.
  2. Open the Environment Variables and select the “PATH” variables from the System variables list and click on “Edit”.
  3. In the environment variables, remove all the Java Paths for the versions we have removed.
  4. Repeat the same steps for the PATH variable in the “User variables” as well.

clearing the PATH variable

7. What if a Java uninstall fails?

In the rare scenario that a Java uninstall fails for any reason, Oracle recommends using the Microsoft Utility to correct the registry entries. Alternatively, we can correct the registry entries manually too. For more details, please check here.

8. Verify successful un-installation

To check if we have uninstalled Java correctly we have three ways.

8.1 Through the Control Panel

  • Type “Programs” in the search box.
  • Select the “Add or remove programs” which opens the path: Control Panel\Programs\Programs and Features
  • In the Search, type “Java”. It should not return any results.

Uninstall Java - No Java in Programs

8.2 Using the java -version command

Open the Command Prompt and type in java -version command. It gives give a message : “Java is not recognized.” . This means that Java is not installed on our system.

No Java installed on machine

8.3 Using the where command

  • The other way to check is using the where command in the Command Prompt.
  • Open the Command Prompt by typing cmd in the “Type here to search” box and click on the first option.
  • Another way is to press the “Windows icon” + R on the keyboard to open run and then type cmd .
  • It should return an error message saying “Could not find the files for the given pattern(s)”.

where output when no java installed

9. Summary

In the article, we learned how and why to uninstall older versions of Java from a Windows system. We also learned how remove Java completely. Further, we can also Disable Java on web browsers used on the Windows system. Visit the Oracle Java page for instructions to disable java.

Источник

Uninstall all Java versions

I received an inquiry from one of my mid-size (100-200 users) customers today. They’ve been planning an implementation of a new online service which requires the latest Java version.

The clients have a large quantity of outdated versions of Java, which needed to be uninstalled before we deployed the newest version.
They are currently running Windows 7 and Windows 8, so somewhat modern operative systems 🙂

I started by trying out JavaRa which I’ve used previously for other customers. However it did not function the way I wanted. The latest current version (2.6) does not allow a silent uninstall.

I came across a built in solution using Windows Management Instrumentation Command-line (WMIC). It can with a single command-line remove all older versions of the program, without the need of third-party software.

If you want to remove all Java-related software use the following line:

wmic product where "name like 'Java%%'" call uninstall /nointeractive

If you would like to uninstall releases before version 7 (they previously added (TM) in the name) use:

wmic product where "name like 'Java(TM)%%'" call uninstall /nointeractive

For only version 7 and its sub-releases:

wmic product where "name like 'Java 7%%'" call uninstall /nointeractive

To uninstall all Java versions besides Java 8 Update 65

wmic product where "name like 'Java%%' and not name like 'Java 8 Update 65%%'" call uninstall /nointeractive

Please let me know if this helped you or if you need further assistance.

Читайте также:  Php class static include

14 Comments

The WMIC methods works great Except, we need the switch that will keep it from EVER rebooting the system. I am doing silent install of the latest Java versions and I need to 100% uninstall all other versions prior to installing the latest, and the system MUST NEVER reboot until ALL the uninstalls and install are complete. Even then it should not re-boot until I manually tell it to. Thanks for any one who can find the last step to make this the perfect way to get rid of old Java’s silently and install the newest ones. Ralph Reply

There is a switch NOT to reboot, here is an example of what I used: wmic product where «name like ‘Java%%’ and not name like ‘Java 8 Update 151%%'» call uninstall /nointeractive|wmic && shutdown /a Reply

Can I add this command in a batch file and execute it? Does WMIC need anything to start if it the batch file or can it run as a cmd file? wmic product where «name like ‘Java%%’ and not name like ‘Java 8 Update 151%%'» call uninstall /nointeractive|wmic && shutdown /a

wmic product where «name like ‘Java(TM)%%'» call uninstall /nointeractive works well but I have a need to keep one specific older version. Is there any way to and an exception to this command to say delete all over version 7 except for 7.71? Reply

Because Google brought me here I will tell a solution which I found so that others can also use it: wmic product where «name like ‘%%java%%’ and not name like ‘Java 8 Update 65′» call uninstall /nointeractive Reply

The command will cause a reboot if a browser is open when the command is run!
I guess we run commands to kill the open browsers? – Still disruptive. Reply

Hi, If you’re looking for a deployment solution I strongly recommend «PowerShell App Deployment Toolkit» (http://psappdeploytoolkit.com/). Open source, light and highly customizable. But if you’re simply looking for a one-liner the above solution is the best I’ve come across so far. Reply

Hi Soul, Yes, you could create a Program package or put it as a «Pre-install» step in your new application deployment. I always prefer to run a pre-install section which cleans out all the older versions. Best regards,
Joakim Reply

Hi 🙂 For Java 5 (and probably below), use wmic product where «name like ‘J2SE%%'» call uninstall /nointeractive Why Java5 ? We have a very old software which can only work under Java 5 :-/ Reply

Thanks for the info, we’re using Micro Focus ZCM to deploy to both domain connected and dis-joined devices. We’re going with the approach of removing all versions of Java from our desktops. Reply

Источник

Оцените статью