Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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 am totally new to Linux (using Ubuntu) and have been struggling to install Tomcat 6.0.14 on Ubuntu.
The problem I am having is that everytime I try to start the server I get the following error :
Code:
sudo sh /usr/local/tomcat/bin/startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
Yet...
Code:
echo $JAVA_HOME
/usr/lib/jvm/java-6-sun
And java-6-sun is a link to the following directory
Code:
java-6-sun$ ls
bin ext jre LICENSE README.html
COPYRIGHT include lib man THIRDPARTYLICENSEREADME.txt
I'm tearing my hair out now as I can't find anything wrong anywhere - the links all seem fine yet the server just wont run.. Can anyone suggest anything I could try or somewhere I could look please?
Distribution: Fedora (workstations), CentOS (servers), Arch, Mint, Ubuntu, and a few more.
Posts: 441
Rep:
First, welcome to LQ!
How are you actually setting the variable? If you are doing it by defining in a config file (Eg: /etc/profile) make sure to "export" the variable
Code:
Eg: (At the end of /etc/profile)
CATALINA_HOME=/usr/local/tomcat
JAVA_HOME=/usr/lib/jvm/java-6-sun
JRE_HOME=/usr/lib/jvm/java-6-sun
export CATALINA_HOME JAVA_HOME JRE_HOME
What I suspect as happening is, that you might be setting the variable only for a user (Eg: for snawball2 only). If this is the case, make sure your variable value is set in the appropriate user environment your Tomcat server is running as.
Generally, it's ok to set the variable globally as in the above example (i.e. in /etc/profile).
Distribution: Fedora (workstations), CentOS (servers), Arch, Mint, Ubuntu, and a few more.
Posts: 441
Rep:
That's what I said,... If you look at my post, I said:
Quote:
Originally Posted by SkyEye
What I suspect as happening is, that you might be setting the variable only for a user (Eg: for snawball2 only). If this is the case, make sure your variable value is set in the appropriate user environment your Tomcat server is running as.
Generally, it's ok to set the variable globally as in the above example (i.e. in /etc/profile).
So obviously you are setting the variable in your .bashrc.
.bashrc is not a good place to set a variable like this. (what it does is set the variable when ever a bash session is started by you.) You need to put this in a place where the variable would be set globally.
Try putting it in /etc/profile (and you can remove JAVA_HOME from .bashrc). Better to reboot your computer after setting this.
Try putting it in /etc/profile (and you can remove JAVA_HOME from .bashrc). Better to reboot your computer after setting this.
Hi, I've removed the JAVA_HOME variable from .bashrc and tried it in /etc/profile but still exactly the same problem - I've checked java is installed correctly, i'm able to compile and run from my home dir and I've re-downloaded tomcat but still no joy. :`(
Open a terminal and change to your download directory (Eg: $ cd ~/Downloads)
Extract the Tomcat archive (Eg: $ tar xzvf apache-tomcat-6.0.18.tar.gz)
Set the variable JAVA_HOME (or, see Note below) in the same terminal (Eg: $ export JAVA_HOME=/usr/lib/jvm/java-6-sun)
Start the Tomcat server (Eg: $ ./apache-tomcat-6.0.18/bin/startup.sh - please note the "." before the slash)
Note:
If you have just the JRE (not the JDK), then set JRE_HOME instead if JAVA_HOME variable.
And please remove any tailing slashes (Eg: "~/tomcat" instead of "~/tomcat/") in paths.
This should give an output like this, if it was successful:
Using CATALINA_BASE: /home/snowball2/Downloads/apache-tomcat-6.0.18
Using CATALINA_HOME: /home/snowball2/Downloads/apache-tomcat-6.0.18
Using CATALINA_TMPDIR: /home/snowball2/Downloads/apache-tomcat-6.0.18/temp
Using JRE_HOME: /usr/lib/jvm/java-6-sun
This worked for me. I just tested it. Give it a try, if it still persists please try to extract more info about the system/setup.
SkyEye, thanks a lot for all of the assistance! I really appreciate it.. I'll give you the story so far - things have improved but the tomcat server isn't quite running yet (at least I can't access it over network yet).
I followed your instructions to the letter but get the following output :
Code:
snowball2@ubuntu:/$ sudo /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
JRE_HOME is the only thing which is different and I'm still struggling with.. I've defined JAVA_HOME and JRE_HOME in /etc/profile and if I echo $JRE_HOME in shell I get :
Distribution: Fedora (workstations), CentOS (servers), Arch, Mint, Ubuntu, and a few more.
Posts: 441
Rep:
Quote:
Originally Posted by snowball2
Hi,
I followed your instructions to the letter but get the following output :
Code:
snowball2@ubuntu:/$ sudo /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
JRE_HOME is the only thing which is different and I'm still struggling with..
It doesn't matter if your server starts.
After running the startup script, try
$ sudo ps aux | grep java
If it's running you'll get a java process with lot of parameters in the output.
SkyEye, thanks very much for all your help - got it up and running ! IOU 1 beer!
Dear snowball2,
I have exact the same problem with you.
after I follow the following steps:
1. Download a Tomcat binary distribution. Eg: apache-tomcat-6.0.18.tar.gz
2. Open a terminal and change to your download directory (Eg: $ cd ~/Downloads)
3. Extract the Tomcat archive (Eg: $ tar xzvf apache-tomcat-6.0.18.tar.gz)
4. Set the variable JAVA_HOME (or, see Note below) in the same terminal (Eg: $ export JAVA_HOME=/usr/lib/jvm/java-6-sun)
5. Start the Tomcat server (Eg: $ ./apache-tomcat-6.0.18/bin/startup.sh - please note the "." before the slash)
I got the result:
tai@ubuntu:/$ sudo /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr
This means your Tomcat server is running. It's not an error message. So try loading the tomcat test page in your browser.
The steps you followed were steps used temporarily to make sure that there is nothing wrong. Those steps did not set the necessary variables permanently. You can do the final setup by following the steps in, post 6 of this thread.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.