Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to uninstall java from command line independent of version currently installed in machine?

Tags:

cmd

hi i have to write a command line to uninstall java where it get current version already installed in system ?(suppose one system having jre-6u29 where other having jre-7).But i want single command line to uninstall existing version.please help me.

like image 576
user3770462 Avatar asked Jun 25 '14 13:06

user3770462


People also ask

How do I uninstall a specific version of Java?

Click Start, point to Settings, and then click the Control Panel. On the Install/Uninstall tab, click the Java version you want to uninstall, and then click Add/Remove. When you are prompted to continue with the Uninstall, click Yes.

How do I uninstall Java tool silently?

Type the command Setup. bat /s option to initiate a silent mode uninstallation process.


2 Answers

I have not tested this.

Use with EXTREME caution. It WILL NOT prompt for confirmation, and it WILL NOT let you cancel your action

Open a command prompt using administrator rights, and type in:

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

What this simple command is doing is:

  • Find all the products installed on your computer which name starts with "Java"
  • Uninstalls them without asking for confirmation, nor showing any kind of user interface
like image 130
Matias Cicero Avatar answered Jan 01 '23 12:01

Matias Cicero


In order to make sure that you get any installation of Java replace 'Java%' with '%Java%' (obviously). So the command would be:

wmic product where "name like '%Java%'" call uninstall 
like image 26
Torben Hjalholt Avatar answered Jan 01 '23 12:01

Torben Hjalholt