Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently attempted to install java on ubuntu server 12.04 LTS.

I wgetted the tar.gz file and extracted it to /opt/java and then added /opt/java/bin to the path variable. This all works correctly when typing "java" into the command line, however in scripts it acts as if the command does not exist. Thank you in advance for any answers :)

share|improve this question
I think, you failed to make the script executable. – Avinash Raj Mar 30 '14 at 11:35
up vote 1 down vote accepted

did you try putting the whole bin path into the sh file?

/path/to/my/bin blablablajavathigny

if it stil dont work, have you chmodded it? like chmod +x

share|improve this answer
It is already 'chmod +x'ed. Also, is 'path/to/my/bin' supposed to mean '/opt/java/bin' (already done) or '/opt/java/bin/java'. – john01dav Mar 30 '14 at 12:00
/opt/java7/bin/java is the correct one, good luck – wiak Mar 30 '14 at 12:31
@jhon01dav From the terminal, what is the output of whereis java? – PlasmaPower Mar 30 '14 at 14:41
"java: /usr/share/java /opt/java/bin/java" – john01dav Mar 30 '14 at 17:11

You must log in to answer this question.

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