PDA

View Full Version : [ubuntu] Java problems? Changing from OpenJDK to SunJDK in Maverick



redaxe90
December 17th, 2011, 01:03 AM
If any of you have problems with Java in Maverick and desire switching from the built in OpenJDK to SunJDK, I found an excellent guide.

The guide was meant to help people install a Free PDF reader, but amongst the directions was an excellent guide on how to switch from OpenJDK to SunJDK (sorry for repeating myself, but this is my first ever helpful post on Linux:))

Head over to Gnostice (http://www.gnostice.com/nl_article.asp?id=182&t=How_To_Install_Free_PDF_Reader_In_Linux#install_ sun_java_runtime_jre_ubuntu_linux).

To be honest, he used the guide to help people making the change using Lucid, but I found that it works perfectly with Maverick as well. If you're running a later model of the OS, then you can maybe run this in a virtual machine, seeing if it works also for 11.04 or even 11.10, perhaps even later models once they're released.

Any sort of feedback would be excellent :)

zvacet
December 17th, 2011, 09:13 AM
If you have two Java versions installed OpenJDK and SunJDK then after installing SunJDK you should run


sudo update-alternatives --config java

and select witch one you want to use.

redaxe90
December 17th, 2011, 09:20 AM
If you have two Java versions installed OpenJDK and SunJDK then after installing SunJDK you should run


sudo update-alternatives --config java

and select witch one you want to use.

Oddly enough, when I tried to run that command, I got this:

update-alternatives: error: no alternatives for java.

Which leads me to believe that the method shown on the Gnostice website pushes OpenJDK out of the way completely, though I can't be sure about that. It's the feeling I get, but being a relative newbie I could have been misled :)

redaxe90
December 19th, 2011, 09:31 PM
I'd like to hear from people running any Ubuntu version, from 10.04 to the latest, to see if anybody could perform this change of JDK packages and if they had to use the
sudo update-alternatives --config java command. I got an error message, anybody else?

zvacet
December 21st, 2011, 01:46 PM
Maybe that way remove OpenJDK when installing SunJDK or you didnīt have and JAva package installed before.I can not think of anything else.

redaxe90
December 24th, 2011, 12:31 PM
I did a clean install of 10.04 when I set up Ubuntu, then promptly upgraded it to 10.10 (probably near the maximum of what my hardware can run until I set up lubuntu). From what I understand, OpenJDK comes bundled with Ubuntu 10 and later, maybe even earlier versions too (I admit total ignorance about that).

In any case, I never had to configure the java settings or default program, it just changed on it's own during setup.