Java[tm] BluePrints for Wireless Gaming Sample Applications 1.0 Early Access > Building and Running the Sample Applications

Building and Running the Sample Applications

Ant, a tool with similar functionality to make, is used to build the sample applications, and to execute the binaries that are built. (Ant has been developed under the auspices of the Apache Software Foundation.) A working version of Ant is provided as part of the sample applications bundle.

Before building the sample applications, make sure your environment variables are set as specified in the installation instructions.

Building the Sample Applications

To build the sample application, bring up a shell or command prompt, change the current directory to {blueprints.dir}/src/apps/jbricks/src or {blueprints.dir}/src/apps/slugs/src, and type:

build.sh <argument> (Solaris or Linux)

build.bat <argument> (Windows)

Build Script Arguments for Java Bricks Sample Application

The following table lists arguments you can use with the build scripts in {blueprints.dir}/src/apps/jbricks/src, and what using each of these arguments accomplishes.

Arguments for the Java Bricks sample application build script
Argument Purpose
all Builds the entire application. (This is the default target.)
clean Cleans out the build output directories.
emulate Runs the application in the emulator.

When the build script is invoked with no arguments, it will build the entire application.

The application is placed in:

{blueprints.dir}/src/apps/jbricks/build/

Build Script Arguments for Java Slugs Sample Application

The following table lists arguments you can use with the build scripts in {blueprints.dir}/src/apps/slugs/src, and what using each of these arguments accomplishes.

Arguments for the Java Slugs sample application build script
Argument Purpose
all Builds the entire application. (This is the default target.)
clean Cleans out the build output directories.
emulate Runs an instance of the client in the emulator. (Note that you need at least two instances to start a game.)
run-server Runs an instance of the server. (Note that you need one instance to start a game.)

When the build script is invoked with no arguments, it will build the entire application.

The client and server parts of the application are placed in:

{blueprints.dir}/src/apps/slugs/build/

Running the Sample Applications

To run the binaries produced by the build, use the build scripts.

Running the Java Bricks Sample Application

This sample application is a stand-alone game, so you just need to start the emulator.

  1. Bring up a shell or command prompt.

  2. Change the current directory to {blueprints.dir}/src/apps/jbricks/src.

  3. Enter the following command:

    build.sh emulate (Solaris or Linux)

    build.bat emulate (Windows)

Running the Java Slugs Sample Application

There are two parts to the Java Slugs sample application: A J2ME client, and a server using the J2SE APIs. You need one instance of the server and at least two instances of the client to start a game.

  1. Run the server.

    1. Bring up a shell or command prompt.

    2. Change the current directory to {blueprints.dir}/src/apps/slugs/src.

    3. Enter the following command:

      build.sh run-server (Solaris or Linux)

      build.bat run-server (Windows)

  2. Run a client.

    1. Bring up a shell or command prompt.

    2. Change the current directory to {blueprints.dir}/src/apps/slugs/src.

    3. Enter the following command:

      build.sh emulate (Solaris or Linux)

      build.bat emulate (Windows)

  3. Run another client.

    The Java Slugs sample application is a two-player game, so you need two emulators running. Just repeat the previous step once more.


© 2002, 2003 Sun Microsystems, Inc. All rights reserved.