Linux JAVA in path but permissions denied
I am trying to enable JAVA in Intel Edison which is using Yocto (Linux), the problem is that after extracting the zip, im to check the version and when it got in the path, they were unable to access java with all proper permissions.
In particular, I am trying to follow this tutorial , but I am "stuck" at
. .profile
since the next step
java -version
throws the same issue as the insert below, permissions denied or as before, java was not found.
Here's a quick summary of the output:
root@dedsec1:~/java/jdk1.7.0_67/bin# ./java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode)
root@dedsec1:~/java/jdk1.7.0_67/bin# cd
root@dedsec1:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/root/bin:/home/root/java/jdk1.7.0_67/bin:/home/root/java/jdk1.7.0_67/bin
root@dedsec1:~# ./java -version
-sh: ./java: Permission denied
root@dedsec1:~#
What the hell am I missing? I have set chmod -x in java, but it doesn't seem to affect it.
source to share
root
The home folder is not under "/ home". Change this
/home/root/java/jdk1.7.0_67/bin:/home/root/java/jdk1.7.0_67/bin
to
/root/java/jdk1.7.0_67/bin
Besides,
/home/root/bin
it should be
/root/bin
For similar reasons. When writing a script, you can use $HOME
that will expand to where the user's home directory is. Thus,
PATH="$HOME/bin:$HOME/java/jdk1.7.0_67/bin"
Edit
I would not recommend that you link to java
in $HOME/bin
. Let set a JAVA_HOME
and move it to the beginning of PATH, for example
export JAVA_HOME=$HOME/java/jdk1.7.0_67
export PATH="$JAVA_HOME/bin:$HOME/bin:$PATH"
source to share