Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.