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.
you need to set the CATALINA_HOME and JAVA_HOME environment variables as well as update your CLASSPATH environment variable.
You can do this in /etc/profile. If you put it in here, you'll then need to 'source /etc/profile' before you start up tomcat.
Mine:
Code:
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
CVSROOT=/usr/local/cvsroot
pathmunge $CVSROOT after
export CVSROOT
export EDITOR=vim
JAVA_HOME=/usr/java/j2sdk1.4.2_10
pathmunge $JAVA_HOME/bin after
export JAVA_HOME
KOMODO_HOME=/usr/local/Komodo
pathmunge $KOMODO_HOME after
export KOMODO_HOME
ANT_HOME=/usr/local/apache-ant-1.6.2
pathmunge $ANT_HOME/bin after
export ANT_HOME
CATALINA_HOME=/usr/local/tomcat
export CATALINA_HOME
AXIS_HOME=/usr/local/axis
pathmunge $AXIS_HOME/bin after
AXIS_LIB=$AXIS_HOME/lib
pathmunge $AXIS_LIB after
AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery-0.2.jar:$AXIS_LIB/commons-logging-1.0.4.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:$AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/wsdl4j-1.5.1.jar:$AXIS_LIB/axis-ant.jar
CLASSPATH=/usr/local/tomcat/bin:/usr/java/j2sdk1.4.2_10/lib:/usr/local/tomcat/common/lib:/usr/local/tomcat:/usr/java/j2sdk1.4.2_10/lib/mysql-connector-java-3.1.12-bin.jar:$AXISCLASSPATH:/usr/local/xerces/resolver.jar:/usr/local/xerces/xercesImpl.jar:/usr/local/xerces/xercesSamples.jar:/usr/local/xerces/xml-apis.jar
export CLASSPATH
export AXIS_HOME
export AXIS_LIB
export AXISCLASSPATH
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
hi
thx for reply.i export my CATALINA_HOME and JAVA HOME and it runs well.but after some minutes when i tried again it doesn't work.and now some times it workes and some times it doesn't.do u know what happen?
well, if you've export your variables as commands in a shell term (like konsole), those variables are only valid during that shell's session. this means when you exit the shell, the environment variables are lost. If you've set the variables in /etc/profile, the most reliable way to make sure the variables are set everytime you login in or use the shell term would be to reboot the machine, but logging in and out of your session should work, although, I've had logging in and out not work for me before.
My guess is that it doesn't work the next time because you've export those environment variables in a shell term, close the shell term, and then try to start it up again in a new shell term.
But I don't really know, as I'm not using version 5.X of tomcat; I'm using 4.1.31. It could be something like version 5.X is buggy... I couldn't really tell you.
Another thing, update your CLASSPATH environment variable also.
Well let me ask you, how do you boot up into linux? Do you boot straight into graphical mode (init 5)?
Let's pretend you do. Here's the scenario.
You log into your user account. You open up a shell terminal. You su into root so you can start tomcat. You need to set the environment variables, so you do. You start up tomcat. You exit out of root. Now you want to restart tomcat, so you su back into root. Now here is where you'd have problems. Those environment variables you set in your previous session are no longer set. You need to make those environment variables permanent. So look at the example /etc/profile I posted and copy the lines you need in regards to classpath, catalina_home, and java_home.
For the classpath, you'd probably only need:
CLASSPATH=/usr/local/tomcat/bin:/usr/java/j2sdk1.4.2_10/lib
After editing your /etc/profile, log out of your user session and log back in. Your environment variables should be set for you and when you su as root in the shell term.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.