I want to change OpenJDK to SunJava in my ubuntu linux desktop , i have downloaded the "jdk-7.tar.gz" from sun's website, but there problem is how to make the system to use the newly downloaded java ? I tried adding the new jdk/bin/java to my PATH ( from .bashrc ) but that seem not to work (cause probably OpenJDK's path is inside my PATH variable as well , so the system checks that first)

Here's my JDK7 : /usr/lib/jdk7/bin/java
Here's what $(which java) outputs : /usr/bin/java
Thanks in advance


.Try mv /usr/bin/java /usr/bin/java.old; ln -s /usr/lib/jdk7/bin/java /usr/bin/java

  • I did create the soft link you've given me , but i'm getting this :cannot execute binary file (I've given it the permission , the error is not because of not having the permission) any idea why ? – SpiXel Mar 20 '12 at 17:38
  • To undo the link (if you haven't already) use mv /usr/bin/java.old /usr/bin/java and overwrite. As to why? Check the architecture of the jdk7 you downloaded against the architecture of your system (or, if you built it from source, check the build output). Also, see if there is a Java 7 repo/package available for your system's package manager of choice; that's a good way to eliminate build-related problems, and if you really want hand-installed/hand-configured customizations, you can start from a package install and work backwards to figure out where the manual process went wrong. – Zac B Mar 20 '12 at 17:44
  • I've undone the link already , but what's caught my eyes is that why the symbolic ( or soft , whatever ) link is not working :( Um how can I check the architecture of the JDK ?( cause really that might be the problem since i'm using the source which I've found in my friend's hard disk ! ) – SpiXel Mar 20 '12 at 17:47
  • Specifically (per my last suggestion), try this: brunoreis.com/tech/intalling-java-ubuntu-natty – Zac B Mar 20 '12 at 17:49
  • Nah ! It was the architecture yeah , Thanks for bringing that up ! – SpiXel Mar 20 '12 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.