Operating System - HP-UX
1752772 Members
4883 Online
108789 Solutions
New Discussion юеВ

executable visible wherever for any user

 
SOLVED
Go to solution
Carles Viaplana
Valued Contributor

executable visible wherever for any user

Hello,

I installed java1.4 into my HP-UX B.11.11 but when I tried to execute java -version from / I can't, so I must go to /opt/java1.4/jre/bin directory and then execute it.

I need java visible from any directory for any user. I tried to add java path and prefer do not modify .profile for each user.

Is there any easy way to do it?

BTW, how can I do an script can be execute directly instead "./myscript"?

If I can fix both issues will be great.

Thanks in advance for your help.
Regards,

Carles
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: executable visible wherever for any user

Shalom Carles,

This is a permissions problem.

Make sure all users chmod o+rx the directiroes from root down to java

Depending on current permissions you may need also chood g+rx

If you an error message, I could be certain of my advice.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor
Solution

Re: executable visible wherever for any user

Hi Carles:

You can add '/opt/java1.4/jre/bin' to '/etc/PATH'. This is sourced by '/etc/profile' during its execution during login. Hence, the one change will propogate to all users with one change.

As far as being able to do:

# myscript
[ instead of ]
# ./myscript

...This is governed by the presence of a dot (".") in the PATH variable. That's fine to include, as the *last* path, for *non-root* users but should *never* be added to root's path! To do so is a security hole.

Learn to type "./myscript" when you are root and sleep better.

Regards!

...JRF...
Ninad_1
Honored Contributor

Re: executable visible wherever for any user

You can create a soft link in /usr/bin or /usr/local/bin
cd /usr/bin
ln -s /opt/java1.4/jre/bin/java java

Regards,
Ninad
Enrico P.
Honored Contributor

Re: executable visible wherever for any user

Hi,
you can add the java path to the PATH variable in the /etc/profile.
In the user' .profile generally the PATH variable call the PATH in the /etc/profile.

Enrico
rariasn
Honored Contributor

Re: executable visible wherever for any user

Hi Carles,

#ll -d /opt/java1.4 drwxr-xr-x 9 root root 1024 May 12 2005 /opt/java1.4
#ll -d /opt/java1.4/bin
dr-xr-xr-x 5 bin bin 1024 May 12 2005 /opt/java1.4/bin
#ll -d /opt/java1.4/jre
dr-xr-xr-x 7 bin bin 1024
#ll -d /opt/java1.4/bin/java
-r-xr-xr-x 1 bin bin 138936 Jul 13 2005 /opt/java1.4/bin/java
#ll -d /opt/java1.4/bin/java
# /opt/java1.4/bin/java -version
java version "1.4.2.09"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2.09-050713-03:34)
Java HotSpot(TM) Server VM (build 1.4.2 1.4.2.09-050713-05:46-PA_RISC2.0 PA2.0 (aCC_AP), mixed mode)

rgs,

ran
Carles Viaplana
Valued Contributor

Re: executable visible wherever for any user

I added path to /etc/PATH file.

Thanks to all.
Regards,

Carles