LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   JAVA_HOME path not set for all users (https://www.linuxquestions.org/questions/linux-software-2/java_home-path-not-set-for-all-users-163306/)

tantric 03-28-2004 05:16 AM

JAVA_HOME path not set for all users
 
I need to set the JAVA_HOME enviroment variable for the wwwrun user. I am executing a script inside the htdocs directory (apaches xalan.sh/fop.sh), I can run xalan.sh and fop.sh from the command line, as my JAVA_HOME is set correctly.

My wwwrun user used to be able to run the xalan.sh with no problems, but now it is reporting that JAVA_HOME is not set correctly. I have no idea how to set the path for a user that never logs in (so I can't set it in the .profile file).

Does anyone have any ideas about this one?

I am tearing my hair out.

Thanks

Andrew Benton 03-28-2004 06:00 AM

Try adding
export JAVA_HOME=/path/to/java
to /etc/profile
If there is no file called profile in the /etc folder, try creating one in a text editor.

tantric 03-29-2004 02:30 AM

:(

Oh well, that didn't work. I am close to tearing down the whole server and starting again! I just don't understand why it would stop working?!!?

Thanks for the suggestion

MunterMan 03-29-2004 04:00 AM

In your /etc/profile.d directory there should be two files called jre*.sh and jre*.csh.
These are executed at start up and will set the environment for your jre.
If they don't exist, they are plain text and look like this
(NOTE: one has curly brackets and endif)

jre-latest.csh:
if ( ! $?JAVA_HOME ) then
setenv JAVA_HOME /usr/java/j2re1.4.2_01/jre
setenv PATH "${PATH}:${JAVA_HOME}/bin"
endif


jre-latest.sh:
if [ -z "$JAVA_HOME" ]; then
export JAVA_HOME=/usr/java/j2re1.4.2_01/jre
export PATH="$PATH:$JAVA_HOME/bin"
fi


Make sure the path is correct. The files you are looking for are binaries called java and java_vm and should be in /usr/java/j2re1.4.2_01/jre/bin

tantric 03-29-2004 05:05 AM

I checked out those files and they all point correctly at where java resides on my system.

Everything is okay whilst Im logged in as root, I can run xalan.sh all day long, as soon as I used PHP to run it (wwwrun user). Xalan.sh reports back to me that JAVA_HOME is not correctly defined, very odd.

Mmm, maybe ill re-install Java, see what that does.


Thanks for the suggestions

tantric 03-29-2004 01:25 PM

I re-installed Java, but no luck there.

In the end I manually adjusted the $JAVA_HOME variable in the xalan.sh and fop.sh, this is so strange as the whole thing worked for weeks without having to do this.

Heres hoping to it working for another 24 hours.

Thanks for all the suggestions

:)


All times are GMT -5. The time now is 06:06 PM.