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 :)

  • I think, you failed to make the script executable. – Avinash Raj Mar 30 '14 at 11:35

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 file.sh

  • 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 – nwgat 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.