element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Achievement Levels
    • Benefits of Membership
    • Feedback and Support
    • Members Area
    • Personal Blogs
    • What's New on element14
  • Learn
    Learn
    • eBooks
    • Learning Center
    • Learning Groups
    • STEM Academy
    • Webinars, Training and Events
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Arduino Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Project Groups
    • Raspberry Pi Projects
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Or choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog Tomcat on my Pi
  • Blog
  • Documents
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Raspberry Pi Projects requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: PEarle
  • Date Created: 2 May 2014 12:17 PM Date Created
  • Views 1675 views
  • Likes 2 likes
  • Comments 3 comments
  • tomcat
  • pi
  • raspberry_pi_projects
  • java
Related
Recommended

Tomcat on my Pi

PEarle
PEarle
2 May 2014

I decided to install Tomcat on my Pi and see what the performance is like.

 

First thing to do is make sure I have got the latest version of all my currently installed function - e.g. use command

 

sudo apt-get update
 

 

Step 1 - Install Java

 

Java installation is very straightforward with the following command

 

sudo apt-get install oracle-java7-jdk
 

 

Once that has finished you can check that Java installed correctly  with the command java -version. You should get something like this

 

image

 

To double check that it was installed I wrote and compiled a simple java class - of course it had to be "HelloWorld".

 

Using the 'nano' editor, I created a file called HelloWorld.java which contains the following ;

 

public class HelloWorld {
     public static void main(String args[]) {
          System.out.println("Hello World !!");
     }
}
 

 

I compiled this with the command javac HelloWorld.java which created class file HelloWorld.class.

 

Finally I executed the class using command java Helloworld and saw the expected output - i.e.

 

image

 

Step 2 - install Tomcat


Download Distribution


Get the Tomcat distributions and unzip it as follows

 

wget http://mirrors.axint.net/apache/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz
tar xzf apache-tomcat-7.0.42.tar.gz

 

This will unpack the distribution underneath your current location (e.g. /home/pi/apache-tomcat-7.0.42)

 

Configure user

 

Before we start tomcat we need to configure an administrator user. Edit file tomcat-users.xml in the conf subdirectory (e.g. sudo nano conf/tomcat-users.xml) and add an entry under <tomcat-user>

 

e.g. add <user username="system" password="raspberry" roles="manager-gui"/>

 

image

 

Start up

 

To start up Tmcat run startup.sh in the bin sub-directory - e.g. sudo bin/startup.sh

A small informational message will display and then the console will free up . Tomcat is now running in the background - to check this enter ps -ef | grep java and you should see something similar to the following;

 

image

 

The best test of course is to try it in a browser - open a browser (which can be on another machine on your network) and enter URL e.g. 10.13.36.255:8080  (i.e. <server_name>:8080) and you should see something like this:

 

image

  • Sign in to reply
Parents
  • Former Member
    Former Member over 9 years ago

    I have already installed Apache2 on my Raspberry Pi B+ - OS is Raspbian. Now I want to install Tomcat.  Should I uninstall Apache2 or can I install Tomcat over the top of Apache2 without issues?

     

    In another case where I do not have Apache2 installed, does Tomcat come with its own version of Apache?

     

    Thanks...RDK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • froller
    froller over 7 years ago in reply to Former Member

    Tomcat is a separate server. You can run Apache and Tomcat at the same time. (One simple difference to spot is the port. Try running apache and tomcat at the same time and go to http://localhost/ you'll see apache staryt page. Then point your broswer to http://localhost:8080/ and you'll see tomcat start page) Both pieces of software are pretty heavy though, so it might be slow when ran on memory/cpu restricted machines such as Raspberry PI etc.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • froller
    froller over 7 years ago in reply to Former Member

    Tomcat is a separate server. You can run Apache and Tomcat at the same time. (One simple difference to spot is the port. Try running apache and tomcat at the same time and go to http://localhost/ you'll see apache staryt page. Then point your broswer to http://localhost:8080/ and you'll see tomcat start page) Both pieces of software are pretty heavy though, so it might be slow when ran on memory/cpu restricted machines such as Raspberry PI etc.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube