- Как удалить OpenJDK?
- Почему это происходит
- Удалять openjdk-7-jre
- How To Uninstall JDK From Linux ?
- Uninstall Oracle JDK
- Uninstall Openjdk
- How to Uninstall (Oracle Java & openJDK) in Linux
- Why should we remove Java?
- 1) Checking current version of Java
- 2) Check if you have installed any other Java version
- 3) Checking Java installation method
- 3.a) Checking Java installation method on Debian/Ubuntu
- 3.b) Checking Java installation method on RPM based systems
- 4) Removing Java in Linux
- 4.a) Removing Java in Debian/Ubuntu
- 4.b) Removing Java in RPM based system
- 4.c) Uninstalling Oracle Java
- 5) Checking Java version
- Closing Notes
- Related Posts
- How to install Oracle Java (JDK/JRE) 8/11/12 in Linux?
- How to Enable Java plugin support on Firefox on Linux
- How To Install Oracle Java 7, 8 & 9 (JDK & JRE) on Debian Via Repository
- About Magesh Maruthamuthu
- 17 Comments on “How to Uninstall (Oracle Java & openJDK) in Linux”
- How to uninstall OpenJDK?
- 6 Answers 6
- Why this happens
- To remove openjdk-7-jre
Как удалить OpenJDK?
Я не хочу OpenJDK устанавливать в моей системе Ubuntu 13.04, но при попытке удалить openjdk-7-jre выдает следующее сообщение:
Что мне нужно сделать, чтобы при удалении не было установлено никаких новых пакетов, из которых я не нуждаюсь openjdk-7 ?
Вы можете использовать следующую команду:
Таким образом, новые пакеты не будут установлены. Вот мой вывод для вышеуказанной команды:
Но я не советую вам делать это. В один прекрасный день вам наверняка понадобится OpenJDK (6 или 7).
Отличный вопрос, мне самому было интересно.
Я обнаружил, что вы можете использовать следующее для удаления openjdk-7-jre в Ubuntu 13.04:
Нажмите «y», а затем нажмите ввод, когда будет предложено подтвердить это изменение. Это также должно очистить все дополнительные библиотеки зависимостей, которые были установлены с ним.
Я также обнаружил, что вы можете использовать следующую команду для выполнения дополнительной очистки:
Если вы используете следующую команду:
Вы больше не должны видеть, что openjdk-7-jre установлен!
Надеюсь это поможет. 🙂
Почему это происходит
Вероятно, это происходит потому, что другой пакет в вашей системе зависит от Java. При удалении openjdk-7-jre , apt-get видит , что если удалений OpenJDK, некоторые пакеты имеют неудовлетворенные зависимости. Чтобы решить эту проблему, он устанавливает другой пакет, который обеспечивает Java.
Чтобы выяснить, что является причиной этого, выполните следующие команды в терминале:
Это указывает на то, что все пакеты LibreOffice зависят от openjdk-7-jre . Пока эти пакеты установлены, OpenJDK не может быть удален без автоматической установки альтернативной Java.
Удалять openjdk-7-jre
Если вы хотите удалить openjdk-7-jre (без установки других пакетов), вам нужно будет удалить все пакеты, которые зависят от него в первую очередь.
Из выходных данных примера это будет:
Я заметил, что вы сказали, что хотите использовать Oracle JDK. Если вы хотите вместо этого установить Oracle JDK, вы можете скачать его и распаковать в любое удобное для вас место.
Затем вы просто используете альтернативы обновления, чтобы сообщить вашей системе, где установлена Java. Если вы не уверены в синтаксисе альтернатив обновления, вы можете использовать для него внешний интерфейс, альтернативы.
Например . Я довольно широко использую JDK от Oracle.
Я извлекаю его в / opt / java /.
Затем, так как все двоичные файлы Oracle Java являются основными утилитами для вещей, связанных с Java, я делаю следующее с альтернативами обновления:
Это берет все утилиты Oracle Java, которые вы ранее извлекли, и дает им первый приоритет, если у вас установлены другие версии Java. (поскольку Ubuntu позволяет вам иметь несколько версий одной и той же утилиты)
Наряду с остальными ответами — проверили ли вы свой .bashrc файл, чтобы убедиться, что среды JAVA_HOME там нет? Удаление этой строки должно помочь избавиться от Ubuntu от openjdk. Как пример:
Если вы видите что-то подобное, удалите эти две строки и перезагрузитесь.
Чтобы удалить OpenJDK, вам нужно запустить эти команды в вашем терминале. Вы можете получить терминал с помощью этих клавиш, ctrl + shift + enter .
Удалить только Openjdk:
Удалите Openjdk вместе с зависимостями:
Удалите Openjdk и его конфигурационные файлы:
Удалите Openjdk вместе с зависимостями и файлами конфигурации:
Источник
How To Uninstall JDK From Linux ?
This tutorial is written to help New Linux Users, who want to uninstall Java Development Kit (JDK) installed on their Linux. The tasks performed on Ubuntu 16.04, but this will also work on other Debian Based Linux like Linux Mint, Kali Linux, etc.
So, first of all, check the vendor of the JDK you have installed on your system, whether it is Oracle JDK or Openjdk. For that execute the following command in the terminal:
$ java -version
If you have Oracle JDK installed then you will get the following result:
Else if you have Openjdk installed then you will get the following result:
Now follow the instructions below according to the JDK you have installed.
Uninstall Oracle JDK
Remove The Link
First of all remove the alternatives by executing the following commands:
- $ sudo update-alternatives —remove «java» «/usr/lib/jvm/jdk[version]/bin/java»
- $ sudo update-alternatives —remove «javac» «/usr/lib/jvm/jdk[version]/bin/javac»
- $ sudo update-alternatives —remove «javaws» «/usr/lib/jvm/jdk[version]/jre/bin/javaws»
Note: Replace the [version] with any version number that’s contained in jdk folder’s name. For example: jdk1.8.0_131 .
Remove The Package
After removing link, remove the package inside /usr/lib/jvm/jdk[version] by executing following command:
$ sudo rm -r /usr/lib/jvm/jdk[version]
Uninstall Openjdk
If you want to remove Openjdk only, execute the following command on terminal:
$ sudo apt-get remove openjdk*
If you want to remove Openjdk along with dependencies, execute the following command on terminal:
$ sudo apt-get remove —auto-remove openjdk*
If you want to remove Openjdk and it’s configuration files, execute the following command on terminal:
$ sudo apt-get purge openjdk*
If you want to remove Openjdk along with dependencies and it’s configuration files, execute the following command on terminal:
$ sudo apt-get purge —auto-remove openjdk*
This is how you can uninstall JDK. Share this, if it is helpful to you and please report us if you found and error in this post. Thank you.
Источник
How to Uninstall (Oracle Java & openJDK) in Linux
Most of us believe that uninstalling Java is a difficult task in Linux, but it’s not as per my opinion, because I have installed Java on various distributions several times and removed it safely without any problems.
To do so, you need to check few things before removing JAVA.
In general, people install ‘Oracle Java’ or ‘openJDK’ depending on their need.
In this guide, we will show you how to uninstall/remove Java in Linux. By looking at the steps below, you will realize how easy it is.
Why should we remove Java?
You may need to uninstall Java from your system for below common reasons:
- You may need to install latest version due to application compatibility.
- You no longer need Java on your system
Refer the below link for installing Java on various Linux distributions.
1) Checking current version of Java
Installed Java version in Linux system can be verified using the following command. The below output shows that we have Oracle Java version “1.7.0_72” :
2) Check if you have installed any other Java version
For various reasons, some users might have installed multiple Java versions which can all be listed together using the ‘update-alternatives’ command as shown below.
As per the following output, we have installed three Java versions and ‘Oracle Java 7’ is the one that’s currently active on the system:
3) Checking Java installation method
Before uninstalling Java, you should find how Java was installed in the system. It could be installed using one of the below methods:
- Manual method
- From the rpm file
- Distribution repository or Third-party repository
As stated in the beginning of the article, user would have installed Oracle Java or openJDK.
- OpenJDK : Everybody uses distribution official repository to install openJDK.
- Oracle JAVA : User might use one of these methods viz. Manual or Third-party repository or RPM file.
3.a) Checking Java installation method on Debian/Ubuntu
Use the below commands to check how JAVA was installed on an Ubuntu/Debian system. As per the below output, “OpenJDK 1.7.0_65” has been installed from the Ubuntu repository:
Feel free to double check whether “OpenJDK 1.7.0_65” was installed from the Ubuntu repository by running the below command, which in our case shows that it was installed from the Ubuntu official repository as shown below:
As per the below output, “Oracle Java 7” has been installed from third-party repository, namely «webupd8» :
Also, we can see that “Oracle JAVA 8” was installed using the manual method, as it is located under the ‘/opt’ directory, see below:
3.b) Checking Java installation method on RPM based systems
Use the below commands to find out how JAVA was installed on RPM based systems, such as RHEL, CentOS, Fedora and openSUSE. The following output shows that, “OpenJDK 1.7.0_71” was installed using the CentOS repository:
You can double check the above result by running the below command:
Also, the “Oracle Java 8” was installed manually using the RPM file as per the following output, because it doesn’t show the distribution version which was shown in the previous output:
4) Removing Java in Linux
Now that we have understood how to find out the installation method of JAVA on a Linux system, let’s proceed to understand how to remove/uninstall JAVA.
Uninstalling Oracle Java or openJDK can be done in multiple ways and you can use a suitable method as you see fit. This section summarizes some of those methods.
4.a) Removing Java in Debian/Ubuntu
You may need to run these commands based on section ‘3.a’ to uninstall ‘Oracle Java’ or ‘OpenJDK’ in Ubuntu/Debian systems:
4.b) Removing Java in RPM based system
You may need to run these commands based on section ‘3.b’ to uninstall ‘Oracle Java’ or ‘OpenJDK’ in Red Hat, CentOS, Fedora and openSUSE systems:
4.c) Uninstalling Oracle Java
Alternatively, Oracle Java can be removed from the Linux system using the ‘update-alternatives’ command as shown below.
(replace the word (version)with your Java version. DO java -version to get yours. So if your version is 1.8.0-92, you would type sudo update-alternatives –remove “java” “/usr/lib/jvm/jdk1.8.0-92/bin/java”)
Now, remove the corresponding JDK folder by executing the following command:
5) Checking Java version
At this stage, we have completely removed openJDK & Oracle Java from our system. If no Java version is installed on the system, you will get the following message:
Closing Notes
In this article, you learnt how to install ‘Oracle Java’ or ‘OpenJDK’ in various Linux distributions such as Ubuntu, Debian, RHEL, Fedora, CentOS and openSUSE.
If you found this article helpful, please do share with your friends and spread the knowledge. Please feel free to comment below if you have any queries/concerns. We will get back to you as soon as we can. Happy learning!
Related Posts
How to install Oracle Java (JDK/JRE) 8/11/12 in Linux?
October 25, 2017 January 16, 2020
How to Enable Java plugin support on Firefox on Linux
March 17, 2016 April 25, 2016
How To Install Oracle Java 7, 8 & 9 (JDK & JRE) on Debian Via Repository
February 9, 2016 February 8, 2016
About Magesh Maruthamuthu
Love to play with all Linux distribution
17 Comments on “How to Uninstall (Oracle Java & openJDK) in Linux”
im on kalilinux 2020.4 i installed java 11.0.9 and java jdk 8 u217
when i write java -version
lzh:permission denied java
it’s not about root there is another errorr help me plz
Can you share with us en exact error message that you are getting to understand more about it?
I see you don’t monetize your website, i think there is one opportunity to earn additional cash on your page,
search in google for: idol4jp makes money
Hi Magesh,
Please see my post here. How do I remove Java 7?
# java -version
If ‘java’ is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf java
linux-bi4s:
# update-alternatives –config java
update-alternatives: error: no alternatives for java
linux-bi4s:
# rpm -qa | grep java
timezone-java-2014h-1.1.noarch
java-1_7_0-openjdk-1.7.0.71-1.1.x86_64
libjavascriptcoregtk-1_0-0-2.4.6-1.4.x86_64
java-1_7_0-openjdk-headless-1.7.0.71-1.1.x86_64
libjavascriptcoregtk-3_0-0-2.4.6-1.4.x86_64
libjavascriptcoregtk-4_0-18-2.6.1-1.1.x86_64
java-binfmt-misc-1.4-4.1.3.x86_64
linux-bi4s:
# rpm -qa | grep jdk
java-1_7_0-openjdk-1.7.0.71-1.1.x86_64
java-1_7_0-openjdk-headless-1.7.0.71-1.1.x86_64
linux-bi4s:
# rpm -e java-1_7_0-openjdk-1.7.0.71-1.1.x86_64
error: Failed dependencies:
jre-64 > 1.5 is needed by (installed) libreoffice-writer-extensions-4.3.2.2-1.3.x86_64
jre-64 > 1.5 is needed by (installed) libreoffice-calc-extensions-4.3.2.2-1.3.x86_64
linux-bi4s:
Источник
How to uninstall OpenJDK?
I don’t want OpenJDK installed on my Ubuntu 13.04 system, but trying to uninstall the openjdk-7-jre yields the following message:
What do I need to do so that no new packages, of which I need none, will be installed when removing openjdk-7 ?
6 Answers 6
Great question, I was wondering this myself.
I found that you can use the following to remove the openjdk-7-jre on Ubuntu 13.04:
Press ‘y’ and then press enter when prompted to confirm this change. This should also clean up all the additional dependency libraries that were installed with it.
I also found you can use the following command to perform additional clean up:
If you use the following command:
You should no longer see the openjdk-7-jre installed!
Hope this helps. 🙂
You can use the following command:
In this way no new packages will be installed. Here is my output for the above command:
But, I don’t suggest you to do this. In one day you will need for sure an OpenJDK (6 or 7).
Why this happens
This happens likely because another package on your system is depending on Java. While removing openjdk-7-jre , apt-get sees that if it uninstalls OpenJDK, some packages will have unmet dependencies. To solve this, it installs another package which provides Java.
To find out what is causing this, run these commands in a terminal:
This indicates that all the LibreOffice packages are depending on openjdk-7-jre . As long as these packages are installed, OpenJDK cannot be uninstalled without installing an alternate Java automatically.
To remove openjdk-7-jre
If you want to remove openjdk-7-jre (without installing other packages), you will need to uninstall all packages which depend on it first.
From the example output, that will be:
To uninstall OpenJDK, you need to run these commands in your terminal. You can get the terminal by using these keys, ctrl + shift + enter .
Remove Openjdk only:
Remove Openjdk along with dependencies:
Remove Openjdk and it’s configuration files:
Remove Openjdk along with dependencies and it’s configuration files:
I notice you said you wanted to use Oracle’s JDK. If you want to install Oracle’s JDK instead, you can download that and extract it in the location of your choice.
Then you just use update-alternatives to tell your system where Java is installed. If you’re not sure about the syntax of update-alternatives, you can use the front-end for it, galternatives.
For example. I use Oracle’s JDK quite extensively here.
I extract it to /opt/java/.
Then, so all of Oracle Java’s binaries are the primary utilities for Java-related stuff, I do the following with update-alternatives:
This takes all of the Oracle Java utilities that you’ve previously extracted, and gives them the first priority, in case you have other versions of Java installed. (since Ubuntu allows you to have multiple versions of the same utility installed)
Источник