10 May 2010


Prerequisite knowledge

This article is intended for users of Ubuntu Linux 9.04. If you're using a different version or a different distribution, you may need to modify these steps to complete the set up process.

User level


BlazeDS is an open source server from Adobe, which delivers Java remoting and web messaging technology so developers can easily implement advanced Message Exchange Patterns (MEPs) and more efficient protocols to access back-end distributed data. Consumers of BlazeDS services and endpoints can be built upon Adobe Flash Platform technologies.

The evolution towards more engaging RIAs has created the need for better data connectivity options. Remoting simplifies the reuse of existing server logic by automatically marshalling calls between the client and the Java methods on the server. In addition, the use of the AMF binary data transfer format increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.

One of the goals of BlazeDS, of course, is to make things easier for developers. This article provides instructions to get BlazeDS up and running on 32-bit Ubuntu Linux 9.04 (Jaunty Jackalope).

Configuring and installing the Java Development Kit

Before running BlazeDS, you'll need to make sure the Java Development Kit (JDK) is installed on your system.

  1. Open a terminal window.
  2. At the prompt type javac and press Enter.

If the JDK is installed you'll see usage instructions, for example:

Usage: javac <options> <source files> Where possible options include: . . .

If the JDK is not installed, you'll see a list of packages that include javac (see Figure 1), for example:

The program 'javac' can be found in the following packages: . . .

If you have a version 1.5 of higher JDK installed, you can proceed to Setting up BlazeDS. (To check the version, type java –version in the terminal and press Enter.)

If not, continue with the following steps in the next section.

Use apt-get to install the JDK

To install the JDK, you can use the apt-get command, which is one of my favorite features of Ubuntu. The apt-get command runs a powerful command-line tool used to work with the Linux Advanced Packaging Tool (APT). You can use it to install new software packages, upgrade existing software packages, and more. It can even update the operating system. For server administrators, apt-get has numerous advantages over other package management tools available in Ubuntu. It's easy to use with simple terminal connections (such as SSH) and it can be used in system administration scripts, which can, in turn, be automatically run by the cron scheduling utility.

  1. In the terminal, type sudo apt-get install sun-java6-jdk and press Enter to start the installation of the Sun Java JDK.

    I chose this package over the others available because I consider it the reference implementation for a JDK.

  2. When you're asked for the administrator password, type it and press Enter.

After apt-get downloads and installs the required packages (see Figure 2), you'll be presented with the Sun license agreement.

  1. Read the first screen of the license agreement, press the Tab key once to highlight the Ok at the bottom of the screen (see Figure 3), and then press Enter.
  1. On the second screen of the license agreement, press the Tab key to highlight Yes, and then press Enter.
  2. When the JDK is installed and configured, type javac at the command line. You should see the proper output (the usage instructions shown in step 2 of the previous section).


After installing the JDK, you need to configure the $JAVA_HOME environmental variable by setting it to the location of the JDK install directory. On my system the JDK was installed in /usr/lib/jvm/java-6-sun/ by default.

You can find the install directory for your system by following the symbolic links for the java program:

  1. Open a terminal, type whereis java at the command line, and press Enter.

    My system returned the following:

administrator@ubuntu-904:~/Desktop$ whereis java java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
  1. Next, type ls –l followed by the pathname with bin/java in it; for example, type ls –l /usr/bin/java and press enter.

    You'll likely see that /usr/bin/java is a symbolic link to another file, in my case it was a link to /etc/alternatives/java.

  2. Follow that link as well by typing, for example, ls –l /etc/alternatives/java.

    Ultimately, you'll find the real target, which by default is /usr/lib/jvm/java-6-sun/jre/bin/java. This means that you need to set $JAVA_HOME to /usr/lib/jvm/java-6-sun/.

    To set the environment variable, you need to edit your shell initialization file. The following instructions assume you are using a bash shell; instructions for other shells can be found on Sun's website.

  3. Edit the file ~/.bashrc with a text editor. To use pico, for example, type pico ~/.bashrc and press Enter.
  4. Scroll to the end of the file and insert the following lines (change <your name> and the actual path to the JDK as necessary):
# JAVA_HOME added by <your name> export JAVA_HOME=/usr/lib/jvm/java-6-sun
  1. Save the file. (In pico, press Control+X and then type Y).
  2. Close the current terminal and open another one.
  3. To test your changes, type echo $JAVA_HOME and press Enter.

    You should see the following response:


Setting up BlazeDS

Follow these steps to set up BlazeDS:

  1. Download the Vancouver build of BlazeDS from Web 2 Open, or alternatively use a build from Adobe Open Source.
  2. Unzip the file to your desktop. Ubuntu makes this simple—just double-click the ZIP file, the same as Mac OS X or Windows, and then click Extract. Alternatively, you can right-click the ZIP file and select Extract Here.
  3. Open a terminal and navigate to the folder where you extracted the BlazeDS build; for example, type cd ~/Desktop/BlazeDS and press Enter.

    Depending on how you extracted the ZIP file, you may need to give execute permission to the BlazeDS directory.

  4. Type sudo chmod -R 755 BlazeDS/ and press Enter, then type your root password.
  5. Next, type cd BlazeDS/sampledb and press Enter.
  6. To start the sample database, type sh and press Enter.
  7. Open another terminal and navigate to the BlazeDS folder as you did in step 3.
  8. Type cd BlazeDS/tomcat/bin and press Enter.
  9. To start tomcat, type sh run and press Enter.
  10. Open a web browser, navigate to http://localhost:8400, and click Samples (see Figure 4). (8400 is the default port for tomcat/BlazeDS).

That's it! You are done.

Where to go from here

Now that you have BlazeDS up and running on Ubuntu Linux, you can get up to speed by taking the 30 minute test drive and exploring the other samples.

You can also read Getting started with BlazeDS for instructions on building a messaging application and a remoting application with BlazeDS.