Chapter 2. Setting Up the Environment

In the previous chapter we covered enough theory. Let's prepare to start our Bookshelf case study. We will also cover more on the background as we go along.

But first things first, we need to start by setting up the Felix environment and the tools that will assist in the development.

In this chapter, we will cover the installation of the Felix Framework and quickly cover its contents. Then we'll give it a try to make sure it's well installed.

In this chapter, you will:

  • Prepare the Java development environment
  • Download the latest Felix distribution and install it
  • Inspect its contents and understand their purpose
  • Have a quick introduction to Maven by covering its basic concepts
  • Learn about the Maven plugins provided by the Felix project

So let's start by downloading and installing the Felix Framework.

Setting up the Felix framework

In this section, we will start by checking whether a compatible Java environment is installed on your machine. You will then download and set up a Felix framework, which will be our playground for the coming chapters.

Checking that a JDK is installed

The Felix Framework requires Java 2 or later versions to run. If you haven't done so yet, it's time to have your Java™ Development Toolkit (JDK) environment set up.

We do not cover the JDK's install in here; however, it is easy to find it online. For downloading and installing a copy of JDK, visit: http://www.oracle.com/technetwork/java/javase/downloads/index.html (you'll find the installation instructions on that page).

Double-check that the following items are well configured after installation:

  • The JAVA_HOME environment variable should be set to your Java installation path
  • The PATH environment variable should include the Java installation bin directory: %JAVA_HOME%in (on Unix systems, it would include ${JAVA_HOME}/bin)

Note

The directory paths on Windows and Unix systems are slightly different. In this book, I'll be showing the examples for a Windows operating system.

To quickly check that your JAVA_HOME environment variable is set, open a command prompt and type the following:

C:>echo %JAVA_HOME%
C:jdk1.5.0_16

Here, I have Java 5 installed, but your Java home and version may be different. It depends on the version you have and where you've installed it.

Also, check that the bin directory of the Java installation is on the system PATH:

C:>echo %PATH%
C:jdk1.5.0_16in;.;C:ProgramsDEVELO~1APACHE~1.0in;C:WINDOWS
system32;C:WINDOWS

If you can't find your Java bin directory in the PATH environment variable, then you can add it by editing the entry and setting it to: %JAVA_HOME%in;%PATH%.

Note

Changing environment variables depends on the operating system you're running on. For example, under Microsoft Windows XP, this is done by adding or editing user variables in the Environment Variables (Start -> Control Panel -> System -> Advanced).

Finally, to check that the Java installation is working on a command line shell, execute the following:

C:>java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)

If this command returns error message, then you need to update the PATH and JAVA_HOME environment variables.

Download and unpack the Felix distribution

The starting point is the Felix Framework Distribution. It is a ZIP archive released containing the system bundle, or main framework harness, along with a default selection of bundles, which is suitable for a quick start.

As we advance in the construction of our project, we will download and install more bundles and enrich its functionality; but that's for later.

The latest stable distribution of the Felix Framework can be downloaded from the downloads section of the Apache Felix website (http://felix.apache.org/).

Note

The archive you're looking for is 'Felix Framework Distribution'.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.59.192