Linux : Setting up Raspberry Pi as a Java application server

This page last changed on Oct 24, 2013 by admin.

Preparing the SD card

  • download Raspbian Wheezy (hard float) image from
  • put sd card in a linux machine
  • check where it is mounted with df -h or with GParted

  • unmount the sd card with umount <mount-point>

  • copy the image to the card with

    sudo dd bs=4M if=<image file> of=/dev/sdb

    Note: device name without partition number!

Booting for the first time

Insert the SD card into the Pi and power it on. The OS will start up with a config utility when it is run for the first time. I did the following:

  • enabled SSH
  • boot into console
  • set correct timezone
  • expand filesystem
  • set hostname
  • decrease amount of memory for the GPU to 16M

Reboot after this.

Additional setup

Setup Java 7 SDK

The latest Raspbian images come with Java 7 pre-installed. We only need to set JAVA_HOME properly in /etc/default/tomcat7

Install Tomcat 7

  • sudo apt-get install tomcat7
  • download tomcat distribution and unpack it in /opt
  • install tomcat to run as a service
  • adjust JVM memory configuration in JAVA_OPTS=-Xmx256M