I was installing JDK7 on Ubuntu 12.04 by following the guide posted on web8. The commands posted in the guide were:
sudo mkdir -p /usr/lib/jvm/ #just in case
sudo mv java-7-oracle/ /usr/lib/jvm/
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install update-java
sudo update-java
Till here everything went well. So hopefully jdk was installed correctly, but then when I tried to check the java
version with the command:
java -version
...it gave me this error:
bash: /usr/bin/java: Permission denied
Yes i know this is a permission related issue. And it can be solved using the sudo
command, but can someone tell the exact command? I also checked permissions using ls -l
command and the output was:
-rw------- 1 ankit ankit 5650 Jun 27 2011 java
-rw------- 1 ankit ankit 5805 Jun 27 2011 javac
None of the tutorials and videos i saw were having this issue why is it only me?have i messed up with some default configurations? do i need to change the permission to the /usr/
directory evrytime?
I know this may sound stupid to many here, but i really want to know exactly where I am going wrong.
java/bin
directory from terminal, then runsudo chmod +x *
(* is wildcard which mentions to consider all the files in a directory). As you said you haven't perform any installations this way is because Oracle has changed the licensing terms of distributing JDK, and hence it is not available and maintained in Ubuntu repositories, while you can use OpenJDK 7 instead of Oracle JDK but in that case, you may want to check here. – Kushal May 06 '12 at 07:30