I am using Linux Mint Cinnamon 14. I have set the $JAVA_HOME and $PATH environment variables in ~/.profile as follows:
export JAVA_HOME=/home/aqeel/development/jdk/jdk1.6.0_35
export PATH=/home/aqeel/development/jdk/jdk1.6.0_35/bin:$PATH
I then did source ~/.profile to make the proper changes.
When I execute java -version command to check the active java version, it shows the default (already installed open-jdk) java version. How can I override the default open-jdk with the one I downloaded?
UPDATE:
which java says /usr/bin/java
$JAVA_HOME/bin/java -version says ‘Permission Denied’
sudo $JAVA_HOME/bin/java -version (asks for password, then) says Command not found
but cd $JAVA_HOME/bin, and ls shows that it is right directory.
While it looks like your setup is correct, there are a few things to check:
env– specificallyPATH.command -v javatells you what?javaexecutable in$JAVA_HOME\binand does it have the execute bit set? If notchmod a+x javait.I trust you have
source‘d your.profileafter adding/changing theJAVA_HOMEandPATH?Also, you can help yourself in future maintenance of your JDK installation by writing this instead:
Then you only need to update one env variable when you setup the JDK installation.
Finally, you may need to run
hash -rto clear the Bash program cache. Other shells may need a similar command.Cheers,