0

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)

3 Answers 3

1

Not a final answer, but I wanted to properly format it. I'm on 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.

1
  • the future? as far as I know for a developer the recommendation is always sun jdk for v6 of java. Commented Jul 30, 2011 at 5:48
0

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.

1
  • also the browser plugin, and javaws
    – MeBigFatGuy
    Commented Jul 30, 2011 at 5:27
0

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/