GCJ to Sun Java
It’s always a problem when you have more than one version of a particular product/package and more so if you have both of them co-existing in your system. I was playing around with Selenium yesterday when I had to execute the selenium server jar. It repeatedly kept giving errors and crashing whenever I tried executing the Selenium tests.
Like how a naive person would think, I thought executing “java -jar selenium.jar” would always invoke sun’s version of java since the open-source version invocation to execute is generally
“gij classname ” and “gcj class-name.java” for compilation.
Apparently, it isn’t so! And it was using Open-source’s version of java to execute the jar because of which so many exceptions were thrown! I always hated setting classpaths, modifying profile information, etc. – most of the cases it has never worked for me! Googling a little got me to a solution where you could easily switch from gcj to sun-java and vice-versa.
sudo update-alternatives – - config java
That’s it! All you need to do is just choose which version you want and it uses that as a default value. Isn’t this simply amazing instead of some nasty classpath changes, exporting SHELL variables, etc..! And yes, if you are a web-developer, I suggest you checkout selenium – amazing tool!
Tags: gcj, istreet-dev, Java, selenium, sudo, sun, ubuntu

