Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 at 11:35

1 Answer 1

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

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 at 12:00
    
/opt/java7/bin/java is the correct one, good luck –  wiak Mar 30 at 12:31
    
@jhon01dav From the terminal, what is the output of whereis java? –  PlasmaPower Mar 30 at 14:41
    
"java: /usr/share/java /opt/java/bin/java" –  john01dav Mar 30 at 17:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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