Setting SUN Java environment on Ubuntu
-
28-09-2019 - |
Question
I just installed Ubuntu 10.04 on my personal laptop and wanted to set up my development environment on this.
I see that when i run the command
Installed SUN JDK through synaptic package manager and executed this command:
sudo update-java-alternatives -s java-6-sun
But when i run the command which java
the output displayed is
/usr/bin/java
How do i make sure that it is Sun JDK and not OpenJDK (which was installed in ubuntu by default)
My only concern is :
I want only SUN JDK to be used for all purposes. I do not want OpenJDK..
Thanks in Advance..
Solution
You can config the used JavaVM with:
sudo update-alternatives --config java
Or you just remove all open-jdk packages.
OTHER TIPS
You can see java version via
java -version
Correct me if I'm wrong...
I think you can run echo $PATH
and it'd give you the list of directories in exact order they're supposed to be scanned when the system trying to run the command.
So, I can see several options to resolve:
- If your default java version is wrong, just remove it and install the correct one.
If you need several versions of java by any reason, you can:
modify your PATH environment making your new java path with higher priority. I.g.:
export PATH=/usr/java_xyz/bin:$PATH
Set your JAVA_HOME environment pointing to new java and make your calls with something like:
$JAVA_HOME/bin/java blablabla.class