I wrote this a few months back and I'm not quite sure why I never published it...might have been one of those days...hopefully it's correct, if it's not, please let me know.
Finally decided to do the updates that my Ubuntu has been asking me about for a week or so now. And of course, my Eclipse breaks because Ubuntu keeps trying to change my java to OpenJDK, which does not play together happily with Eclipse (v3.3). I'm sure others must also have this problem, so here is my step by step troubleshooting:
- Did the update change the environment variables?
- Check the bashrc file:
frog@caffiend:~$ vi ~/.bashrc
Where vi is your console editor. You can use any editor you like. The file should contain the following, most likely at the end:
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20/
- Did the update change the symbolic link?
- First find your Sun Java directory. I think it usually gets installed in /usr/lib/jvm. One way is to do a search from the FileSystem using the File Browser for "sun". You're looking for a folder with a name like: java-x-sun-n.n.nn, where x is the version of java (nowadays, most likely 6...possibly 5) and n.n.nn is the release.
- Now check to make sure the java folder is pointing correctly to the alternatives folder:
frog@caffiend~:$ ls -l /usr/bin/java lrwxrwxrwx 1 root root 22 2010-11-02 12:26 /usr/bin/java -> /etc/alternatives/java
- Now check where the alternatives folder is pointing to:
frog@caffiend~:$ ls -l /etc/alternatives/java lrwxrwxrwx 1 root root 36 2010-11-02 12:26 /etc/alternatives/java -> /usr/lib/jvm/java-6-sun/jre/bin/java
- If one or both of these symbolic links are not pointing to the correct location:
frog@caffiend~:$ cd /usr/bin/ frog@caffiend~:$ sudo ln -f -s /etc/alternatives/java java frog@caffiend~:$ cd /etc/alternatives/ frog@caffiend~:$ sudo ln -f -s /usr/lib/jvm/java-6-sun/jre/bin/java java
- Did the update change which Java is being used?
frog@caffiend~:$ udo update-alternatives --config java [sudo] password for frog: There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode 1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode * 2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode Press enter to keep the current choice[*], or type selection number: 2
- Confirm that the correct Java is being used:
frog@caffiend~:$ which java /usr/bin/java frog@caffiend:/usr/bin$ java -version java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)
No comments:
Post a Comment