Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I searched askubuntu and tried the suggestions but failed .I try this question:How to completely uninstall/reinstall Java

1.I run sudo apt-cache search openjdk get the following:

openjdk-6-dbg - Java runtime based on OpenJDK (debugging symbols) openjdk-6-demo - Java runtime based on OpenJDK (demos and examples) openjdk-6-doc - OpenJDK Development Kit (JDK) documentation openjdk-6-jdk - OpenJDK Development Kit (JDK) openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless) openjdk-6-jre-lib - OpenJDK Java runtime (architecture independent libraries) openjdk-6-source - OpenJDK Development Kit (JDK) source files icedtea-7-jre-jamvm - Alternative JVM for OpenJDK, using JamVM openjdk-6-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark openjdk-7-dbg - Java runtime based on OpenJDK (debugging symbols) openjdk-7-demo - Java runtime based on OpenJDK (demos and examples) openjdk-7-doc - OpenJDK Development Kit (JDK) documentation openjdk-7-jdk - OpenJDK Development Kit (JDK) openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless) openjdk-7-jre-lib - OpenJDK Java runtime (architecture independent libraries) openjdk-7-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark openjdk-7-source - OpenJDK Development Kit (JDK) source files

2.run sudo apt-get remove openjdk get the following: Reading package lists... Done Building dependency tree
Reading state information... Done Package openjdk-7-jdk is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 182 not upgraded.

share|improve this question
1  
get the answer: sudo dpkg --list; sudo dpkg --list | grep -i jdk thanks @izx –  janwen May 20 '12 at 8:41
add comment

2 Answers

up vote 8 down vote accepted

You cannot remove OpenJDK 7 because it is not installed. If you are trying to remove OpenJDK 6, try sudo apt-get remove openjdk-6-jdk, or sudo apt-get remove default-jdk.

apt-cache search only shows you available packages, not the packages you have installed. For that, try sudo dpkg --list; sudo dpkg --list | grep -i jdk will show you any JDK-related packages installedon your system.

share|improve this answer
    
How can i search the packages i installed?What is the difference between packages available and packages installed? –  janwen May 20 '12 at 8:27
    
I try both commend you post,get the same results: Reading package lists... Done Building dependency tree Reading state information... Done Package default-jdk is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 182 not upgraded. –  janwen May 20 '12 at 8:29
    
Please update question with output of sudo dpkg --list | grep -i jdk. Available means "CAN BE installed after downloading" while installed means "IS installed on your system" –  izx May 20 '12 at 8:30
    
thanks @izx i successed remove openjdk.How can i close the question. –  janwen May 20 '12 at 8:42
    
Please remember to accept the answer if it helped -- this will also close the question. Thanks :) –  izx May 20 '12 at 8:43
add comment

Run this command, which lets you choose which Java installation to make the default:

sudo update-alternatives --config java

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-7-oracle/jre/bin/java         1         manual mode
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.