1

I set the Java command to an alias in my /home/.bashrc.

alias java='/home/documents/jdk1.7/bin/java'.

However, typing java results in:

bash: /home/documents/jdk1.7/bin/java: permission denied
2
  • 1
    Whats the output of ls -l /home/documents/jdk1.7/bin/java?
    – heemayl
    May 3, 2016 at 2:33
  • 1
    sounds like a premissions problem .. I'm attempting to recreate the issue. I will let you know my findings
    – John Orion
    May 3, 2016 at 2:36

1 Answer 1

3

The problem is you do not have permission to access or launch that file under the user you are launching it from.

Since you are using alias the user account accessing the shell needs to have the proper permissions to read/write or execute the file being referenced by the alias.

To test this you could chmod -R a+rX /home/documents/jdk1.7 it should work ... this is not a recommended permission for it but at least that should narrow the problem down.

2
  • 1
    if you ran that command that basically made java read/write/execute for any user ... it only has to be ran once but again .. this can be a security risk because now anyone can run that file.
    – John Orion
    May 3, 2016 at 3:13
  • how to stop accessing the file for all users?
    – Ajay Takur
    Sep 5, 2020 at 4:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .