9

Im trying to get JAVA enabled on Intel Edison which uses Yocto (Linux), the problem is that after extracting the zip, im able to check the version, and when putting it into the path, im not able to access java at all due permissions.

Specifically im trying to follow this tutorial but i get "stuck" at the

. .profile

since next step

java -version

throws same issue as pasted below, permissions denied or as earlier, java was not found.

Heres a quick overview of 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 on java but it doesnt seem to affect it.

0andriy
  • 4,183
  • 1
  • 24
  • 37
Deko
  • 1,028
  • 2
  • 15
  • 24

3 Answers3

14
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.8.0
Srinivasu
  • 1,215
  • 14
  • 32
  • Unfortunately sudo nor such are available, no idea what yocto has for options :/ – Deko Nov 01 '14 at 14:45
  • Tho I correct myself, running chmod a+x /root/bin/java did the trick and am able to call java now, what exactly is a ? I know x is executable. – Deko Nov 01 '14 at 14:49
  • @DanelK a+x mean's add executable permissions to all users – Srinivasu Nov 02 '14 at 03:02
  • Aaaand, the first line was the answer I needed after 3 days of searching! *Closes multiple open tabs and moves on happily* – Koorosh Aug 15 '17 at 19:47
2

root's 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

Also,

/home/root/bin

should probably be

/root/bin

For similar reasons. When writing a script you can use $HOME which will expand to wherever the user's home directory happens to be. So,

PATH="$HOME/bin:$HOME/java/jdk1.7.0_67/bin"

Edit

I would not recommend that you link to java in $HOME/bin. Let's set a JAVA_HOME and move that to the front of the PATH like

export JAVA_HOME=$HOME/java/jdk1.7.0_67
export PATH="$JAVA_HOME/bin:$HOME/bin:$PATH"
Elliott Frisch
  • 198,278
  • 20
  • 158
  • 249
0

You need to be logged in as Root

. .profile

If that doesn't work you can source your file.

source .profile 

note that source is a synonym of '.' (period).

Kalenda
  • 1,847
  • 14
  • 15