Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 4412  / 1 Year ago, tue, december 6, 2022, 8:56:25

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.


More From » 12.04

 Answers
5

Probably the execution flag is not true on this java script.

Try executing sudo chmod +x /usr/bin/java and see if the permission is back.



If that solved the issue, do the same for /usr/bin/javac.


[#38700] Wednesday, December 7, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arsleyeuth

Total Points: 72
Total Questions: 121
Total Answers: 112

Location: North Korea
Member since Mon, Oct 31, 2022
2 Years ago
;