For me it was:
sudo apt-get remove openjdk-6*
sudo apt-get remove icedtea*
Answer from DavidGamba on Stack ExchangeFor me it was:
sudo apt-get remove openjdk-6*
sudo apt-get remove icedtea*
I came across this because I am working through an instructional book for android programming which wants to use a specific Java SE and JRE (8u121) and requests that all other java packages be removed before continuing with the installation. So after reading the above ideas I went with:
sudo apt-get remove openjdk*
and the result was:
bryan@kali:~$ java -version
bash: /usr/bin/java: No such file or directory
So the above suggests that there is no java found of any version. Which is the OP wanted to do (I think).
In case somebody finds this thread because they are uninstalling Java so that they can install an Old Version, I have included a walk-through I found. The first two codes help you install it if you had no GUI. If you have a tarball then skip those. The last codeblock has some parts that you'll need to edit if you are not installing my same version.
{begin copy/paste}
In case that you are attempting to install Java JDK remotely and have absolutely no access to Graphical User Interface and web browser use the following curl method to download Java JDK using a command line.
First, obtain a correct download URL by using the curl command:
$ curl -s http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html | grep "otn-pub" | cut -d \" -f12
The above command outputs a bunch of URLs for your selection. To initiate the download of the desired Java file, copy its URL and start the download using the curl command while accepting the requested Jave license. For example:
$ curl -LOb "oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
Install Java JDK At this stage, we should have an appropriate Java JDK tarball within our current working directory:
$ ls
jdk-8u121-linux-x64.tar.gz
Create a target Java JDK installation directory:
# mkdir /opt/java-jdk
Extract the previously downloaded Java JDK tarball:
# tar -C /opt/java-jdk -zxf jdk-8u121-linux-x64.tar.gz
Set Oracle Java as default Currently, the system does not recognise our Java JDK installation:
$ update-alternatives --list java
update-alternatives: error: no alternatives for java
$ java
bash: java: command not found
Use the update-alternatives command to inlcude both, java and javac as part of the system's Java environment.Please replace the below path to java binaries where appropriate to reflect your downloaded java version:
# update-alternatives --install /usr/bin/java java /opt/java-jdk/jdk1.8.0_121/bin/java 1
update-alternatives: using /opt/java-jdk/jdk1.8.0_121/bin/java to provide /usr/bin/java (java) in auto mode
# update-alternatives --install /usr/bin/javac javac /opt/java-jdk/jdk1.8.0_121/bin/javac 1
update-alternatives: using /opt/java-jdk/jdk1.8.0_121/bin/javac to provide /usr/bin/javac (javac) in auto mode
{end copy/paste}
Okay so after I followed that I wanted to confirm that it works...
bryan@kali:~/Desktop$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
That's it! That's what we want.
Then I became concerned that it 'apt update' may just undo what I did by updating the package (unsure). So I put them on hold. To remove hold: apt-mark unhold.
bryan@kali:~/Desktop$ sudo apt-mark hold openjdk-8*
openjdk-8-jre set on hold.
openjdk-8-jre-headless set on hold.
openjdk-8-doc set on hold.
openjdk-8-jdk set on hold.
openjdk-8-dbg set on hold.
openjdk-8-demo set on hold.
openjdk-8-jdk-headless set on hold.
openjdk-8-source set on hold.
openjdk-8-jre-dcevm set on hold.
openjdk-8-jre-zero set on hold.
how to uninstall Java from windows 10
linux - How to remove old version of Java and install new version - Stack Overflow
how to delete java completely from windows - Stack Overflow
help me uninstall java that is installed and work but not uninstallable by apt or snap???
Videos
Hi,
1-Click on Start
2-The configuration
3-Select System
4-Select Applications and functions
5-Select the program you want to uninstall and click on the Uninstall button.
6-Respond to data requests to complete the uninstallation
Note: If you have problems removing Java, run the Microsoft tool to repair corrupted files and registry keys that prevent programs from starting completely or blocking new installations and updates.
Hi JeanieB.
Well according to the Oracle Java website, the procedure is as follows:
Windows 10 - Uninstall Programs
Click Start
Select Settings
Select System
Select Apps & features
Select the program to uninstall and then click its Uninstall button.
Respond to the prompts to complete the uninstall
https://www.java.com/en/download/help/uninstall...
________________________________________________________
Standard Disclaimer: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.
To remove OpenJDK (the one you've already installed)
sudo apt-get purge openjdk-\*Make a new directory for your new JDK
sudo mkdir -p /usr/local/javaCopy the file to the directory (you should be in that file path)
sudo cp -r jdk-8u45-linux-x64.tar.gz /usr/local/java/Extract the file
sudo tar xvzf jdk-8u45-linux-x64.tar.gzYou should add this to your PATH now. To do that:
a. Open /etc/profile :
sudo gedit /etc/profileb. Scroll down (the end) and add the path where your jdk was installed
JAVA_HOME=/usr/local/java/jdk1.8.0_45 PATH=$PATH:$HOME/bin:$JAVA_HOME/bin export JAVA_HOME export PATHSave and exit
Inform your Linux system where your Oracle Java JDK/JRE is located.
a. Notify the system that Oracle Java JRE is available for use
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_45/bin/java" 1b. Notify the system that Oracle Java JDK is available for use
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_45/bin/javac" 1c. Notify the system that Oracle Java Web start is available for use
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_20/bin/javaws" 1Inform your Linux system that Oracle Java JDK/JRE must be the default Java.
a. Set the java runtime environment for the system
sudo update-alternatives --set java /usr/local/java/jdk1.8.0_45/bin/javab. Set the javac compiler for the system
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_45/bin/javacc. Set Java Web start for the system
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_20/bin/javawsReload your system wide PATH
source /etc/profileCheck the new version and you're done!
java -version
Just unpack the new Java version, for example into /opt. Then do
Copyexport JAVA_HOME=/opt/jdk1.8.0_45
export PATH=$JAVA_HOME/bin:$PATH
Put these exports into the startup files for your shell and you should be set. It is not necessary to uninstall the Java 7 installation.