Installing GlassFish on a Raspberry Pi

This post detail how to quickly have GlassFish running on a Raspberry Pi.
As I don’t have a DVI-HDMI adapter, this install will be headless. My Raspberry Pi setup is simple, an ethernet connection with DHCP and power, no screen, no keyboard attached.

Installing the OS

Download from the Raspbian “wheezy” distribution and dump it to a SD Card. Insert the SD card in the Raspberry, power it. Depending on the SD card performance, the boot process takes between 30 and 60 seconds…

Log in your Raspberry using the default 'pi' user, password: 'raspberry'.
ssh pi@

Invoke the config tool (sudo raspi-config) and select the expand_rootfs option in order to re-size the disk partition. Just quit the config tool to reboot the Raspberry, or invoke the reboot command, the partition size will be adapted…

Installing Java

Installing the OpenJDK ARM port is easy…

ssh pi@
sudo apt-get install openjdk-6-jdk

You can use java -version to validate that the JRE is installed and javac -version to test the JDK install.

Installing GlassFish

mkdir /home/pi/soft
cd /home/pi/soft

There are 2 distributions, is the Java EE 6 Full Profile while is the Java EE 6 Web Profile. Pick the one you want and download it.


Unzip and start GlassFish…

cd /home/pi
unzip soft/
cd glassfish3/bin
./asadmin start-domain domain1

To test your install just curl localhost:8080
You can also drop a simple test/index.jsp in the auto-deploy directory of the installed domain (/home/pi/glassfish3/glassfish/domains/domain1/autodeploy/)

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page - PiTest</title>
        App Server : <%=getServletConfig().getServletContext().getServerInfo()%> <br>
        JVM : <%= System.getProperty("java.version")%> - <%=System.getProperty("java.vendor")%><br>
        Java home : <%= System.getProperty("java.home")%><br>
        OS : <%= System.getProperty("")%> - <%= System.getProperty("os.version")%> <br>
        Architecture : <%= System.getProperty("os.arch")%> <br>