<div class="gmail_quote">On Sat, Nov 5, 2011 at 4:33 PM, Ron Frazier <span dir="ltr"><<a href="mailto:atllinuxenthinfo@c3energy.com">atllinuxenthinfo@c3energy.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I just finished spending an hour reading through a 14 PAGE printed howto<br>
document telling me how to uninstall old Sun Java from Ubuntu and<br>
reinstall the new version and how to do the same thing EVERY time there<br>
is an update. ( If you're interested, here's the procedure:<br>
<a href="https://sites.google.com/site/easylinuxtipsproject/java" target="_blank">https://sites.google.com/site/easylinuxtipsproject/java</a> ) While I<br>
appreciate the publisher of the web page making this available, my<br>
general response is YOU GOTTA BE KIDDING! Now I get to spend HALF an<br>
HOUR on EVERY COMPUTER updating Java EVERY TIME there is an UPDATE!!!<br></blockquote><div><br>Ye gods! I hadn't read that. Yes, that is a long set of commands. Of course most of them are scriptable, but still... And then there is the fact that they don't really appear to work. Following them will give you the proper java, but not the proper javac, javaws, jexec, keytool, etc. I appear to have 30 files in /etc/alternatives related to java, and those instructions seem to fix only one of them.<br>
<br>The update-alternatives and update-java-alternatives do seem to have the capability to link all 30 of those files to the right places, but I've never gotten it to work. So I've given up on it. Too bad.<br><br>
Here's what works for me. It takes about 5 minutes the first time, then only a minute or so subsequently, not counting download time:<br><br>Download the jdk from oracle and install it in /opt, or if you prefer /opt/java. So inside my /opt I have <br>
jdk1.4.2_19<br>jdk1.5.0_22<br>jdk1.6.0_22<br>jdk1.6.0_23<br>jdk1.6.0_24<br>jdk1.6.0_27<br>jdk1.7.0<br><br>Now (as root) edit /etc/profile.d/java.sh and make it read (but correct the version):<br><br>export JDK_HOME=/opt/jdk1.6.0_27<br>
export JAVA_HOME=/opt/jdk1.6.0_27<br>PATH=${JDK_HOME}/bin:$PATH<br><br>Note that the file does not need to be executable.<br><br>For bonus points, add the mozilla plugin:<br><br>ls -lf /opt/jdk1.6.0_27/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins/libjavaplugin.so<br>
<br>This will setup java for anyone who logs in and uses a sh-compatible shell (including bash, of course).<br><br>You might have to go around deleting old versions of the java plugin if one is installed somewhere else.<br>
<br>Now if you have multiple versions installed, you can globally switch them by editing one file. You need to restart your shell to have it take effect. You can also run '. /etc/profile.d/java.sh' in a shell to point to whichever java it points to. Copying that file to a personal directory makes it easy to edit and switch your java without affecting your users.<br>
<br>Hope that helps,<br><br>Michael<br><br><br><br></div></div>