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 am a newcomer to linux and have had lots of problems in installing java on my newly installed Ubuntu 11.10. I use a statistical programming environment called R and many of the packages there require java (the sun variety, I am told). I tried the following :

sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

(after this, I wanted to continue with (but never got that far) :

sudo apt-get install sun-java6-jdk

After this, a window appeared with the heading, "Configuring jre", or something like that. Below was a long list of legal text about accepting Sun's terms. I did not know how to close this window (no obvious option like pressing return worked). After a long time, when nothing seemed to happen, I finally closed the window. After that, I could not open synaptic.

I got the error message :

dpkg was interrupted. You must manually run 'sudo dpkg --configure -a'

I did this. But it does not help. I have java as a "broken" program. When I try to remove the program from synaptic, I get a message that I must reinstall it again.I do not know what I should do.

I want to install jdk6. And also remove the open jdk which is still persistently present in my system.

I tried the clean and purge command shown below. Next, I tried to remove the sun-java6-jre from synaptic. I get the following message :E: sun-java6-jre: Package is in a very bad inconsistent state - you should reinstall it before attempting a removal. When I tried to follow the procedure suggested in the related question (from the link suggested below), I get the following message on trying to install again :Could not mark all packages for installation or upgrade.The following packages have unresolvable dependancies. Make sure that all required repositories are added and enabled in the preferences. sun-java6-bin : Depends: sun-java6-jre but it is not going to be installed


Eliah, Thanks for your reply. I like your principled stand and your spirited defence of it in the link that you have provided. I will come back to this later (and about the multiple options and opinions on installing jdk7). I may also have to take the issue of open jdk vs oracle jdk in the R forums. But I must first solve the problem of removing the broken jre program on my installation, which remains unresolved. I show here the results of the command that you suggested :

ravi@raviM1330:~$ sudo apt-get purge sun-java6-jre sun-java6-plugin sun-java6-fonts
[sudo] password for ravi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package sun-java6-fonts is not installed, so not removed
Package sun-java6-plugin is not installed, so not removed
The following package was automatically installed and is no longer required:
  java-wrappers
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  sun-java6-jre*
0 upgraded, 0 newly installed, 1 to remove and 26 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: error processing sun-java6-jre (--purge):
 Package is in a very bad inconsistent state - you should
 reinstall it before attempting a removal.
Errors were encountered while processing:
 sun-java6-jre
E: Sub-process /usr/bin/dpkg returned an error code (1)
ravi@raviM1330:~$ 

I am now happy to report that my problem with the installation of sun jdk6 is now resolved. Actually, I did not do much myself. I just ran the update manager and this solved the problem of the broken installation. New programs were loaded. Halfway through this update, the window with the legal term screen appeared again. This time, I could tick in one of the boxes stating that I accept the terms (there was no such box previously, or at least, I did not locate it). After that, I went back to synaptic, chose the remaining items from the PPA associated with sun jdk6 and installed them.

The only remaining steps were to remove the open jdk (from the ubuntu software centre) and then to configure Java as required by R (the statistical programming environment for which I required Java). I did this by running the command : R CMD javareconf. This set up the java configuration in /etc/R.

share|improve this question
    
possible duplicate of How to install Java JDK? –  Uri Herrera Nov 13 '11 at 0:06
    
    
nice run, forest! –  H_7 Feb 26 '12 at 19:24

2 Answers 2

up vote 0 down vote accepted

Try this:

sudo apt-get clean && sudo apt-get purge

This should work if your packages are broken. After that reinstall.

share|improve this answer
    
No need to -1 it it doesn't work. –  bioShark Nov 13 '11 at 0:33
    
I am afraid that the above tips are not working. I tried with : –  Ravi Nov 13 '11 at 0:41
    
Sorry, I was not aware of the vote-down and vote-up routines. Thanks for your help. I tried to vote-up but can't seem to get that to work. –  Ravi Nov 13 '11 at 16:41

First of all, you should be aware that the ferramroberto/java PPA no longer contains the latest versions of Oracle Java 6 (and probably never will, because Oracle changed the license terms so newer versions may not be distributed that way). Also, Oracle Java 7 is out. So if you want to use the proprietary version of Java (even though OpenJDK is free open source software, works just as well most of the time, and is available through official, automatically-enabled Ubuntu software sources), you're best advised to obtain it from the Oracle website. (See post #13 in this question, and the links therein, for details.)

With that said, the problem with bioShark's answer was that apt-get purge only purges files from packages that are being removed, and the commands given did not actually tell the package manager to remove any packages. This command should be sufficient (and you don't need to do apt-get clean, which removes cached .deb packages, not configuration files):

sudo apt-get purge sun-java6-jre sun-java6-plugin sun-java6-fonts

Then you should be able to reinstall Java, and you should be prompted to read and sign a license agreement when doing so.

share|improve this answer

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.