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'm new to Ubuntu and Java. How do I correct this?

freestyler@freestyler-HP-ProBook-4420s:~$ sudo apt-get install sun-java6-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-2.6.35-22 linux-headers-2.6.35-22-generic
Use 'apt-get autoremove' to remove them.
Suggested packages:
  sun-java6-demo openjdk-6-doc sun-java6-source
The following NEW packages will be installed:
  sun-java6-jdk
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 0B/19.7MB of archives.
After this operation, 61.2MB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package sun-java6-jdk.
(Reading database ... 194375 files and directories currently installed.)
Unpacking sun-java6-jdk (from .../sun-java6-jdk_6.21dlj-0ubuntu1~maverick1~ppa1_i386.deb) ...
sun-dlj-v1-1 license has already been accepted
Processing triggers for desktop-file-utils ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_US.utf8.cache...
Processing triggers for doc-base ...
Processing 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Processing triggers for python-support ...
Setting up sun-java6-jdk (6.21dlj-0ubuntu1~maverick1~ppa1) ...
update-alternatives: error: alternative path /usr/lib/jvm/java-6-sun/bin/HtmlConverter doesn't exist.
dpkg: error processing sun-java6-jdk (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 sun-java6-jdk
E: Sub-process /usr/bin/dpkg returned an error code (1)
share|improve this question

migrated from stackoverflow.com Aug 1 '11 at 4:16

This question came from our site for professional and enthusiast programmers.

closed as too localized by htorque, Oli Dec 23 '11 at 11:38

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers 3

I use the latest sun jdk to install in ubuntu. I don't know where it went wrong in your installation process above. If you want you can install it manually as i did in my case. I have written blog for that which i myself consult whenever i forget.I think it might help you. The link is : http://manoharbhattarai.wordpress.com/2010/03/23/install-java-manually-in-ubuntu-linux/

share|improve this answer

Not a final answer, but I wanted to properly format it. I'm on Natty (Ubuntu 11.04) and use OpenJDK, this works well by installing it using apt:

sudo apt-get install openjdk-6-jdk 
sudo apt-get install openjdk-6-source

First, get the JDK, then install the JDK sources (for some reason they are not included in the JDK). This worked for 11.04 and 10.04 LTS... maybe it's possible for you to give OpenJDK a try - it's the future anyway.

share|improve this answer
    
the future? as far as I know for a developer the recommendation is always sun jdk for v6 of java. –  Jaime Hablutzel Jul 30 '11 at 5:48

Not sure what's wrong with the installer, but I've always installed the sun jvm by hand. It's not too hard, really .

The jvm (or jvms, there can be multiple ones on your system, especially after upgrades) on ubuntu end up in /usr/lib/jvm. Usually the actual jvm lives in a folder in /usr/lib/jvm, your java & javac executables are softlinks from something like /usr/bin/java -> /etc/alternatives/java -> /usr/lib/java/somejdk.version.blah.blah.blah.

So:

  • download the correct jvm for your hardware, expand it and put it in /usr/lib/jvm (e.g. /usr/lib/jvm/jdk1.6.026)

  • softlink /usr/lib/jvm/jdk -> /usr/lib/jvm/jdk1.6.026 (that way, if you want to swap jvm's later, this is the only link you have to change.

  • point the links your os is using for java (/usr/bin/java) ->to /usr/lib/jvm/jdk/bin/java

  • if you've got any environment variables floating around to JAVA_HOME make sure they point to the jdk directory.

mostly you'll just need java & javac, but there's a fair number of other binaries probably linked in /etc/alternatives that are not used to much, (jhat, jmap, ... ) that's probably better to clean.

share|improve this answer
    
also the browser plugin, and javaws –  MeBigFatGuy Jul 30 '11 at 5:27