Build a Java service using Eclipse

These instructions will install the Scribble and the Asteroids sample services using Eclipse.

Installing the Java sample service using Eclipse is a three-step process.


Create a project

The instructions below are based on Eclipse Neon; the steps may vary slightly if you are using a different version.

  1. Run Eclipse and select the File | New | Project menu option. This will launch a wizard.
  2. In the Select a wizard dialog, choose Java | Java Project and click Next.
  3. Enter a project name (ScribbleApp for Scribble, AsteroidsApp for Asteroids).
  4. Uncheck the Use default location checkbox.
  5. Click the Browse button and navigate to:
  6. Click Next.
  7. Click the Libraries tab.
  8. Click Add External Jars.
  9. Locate the external .jar files:
  10. Select all the jar files then click Open.
  11. Click Finish to create the project.

If the Setting Build Paths dialog appears, click No.

Configure the application plug-in

The plug-in file tells the PureWeb server where to find the service, as well as other information pertaining to the application.

The Java sample service comes with an application plug-in file already created, but when working with Eclipse you must manually edit a few placeholder values in that file.

  1. Open the source plug-in file:
  2. Save a copy at the following location and rename it:
  3. Edit the copy as follows:
    1. Replace instances of the @plugin.bin.dir@ placeholder with the location of the redistributable libs, for example:
    2. Replace instances of the @plugin.classpath@ placeholder with the list of .jar files, for example (these would all be in a single line, but are displayed on multiple lines below for easier readability):

Save and close the edited file.

Build the service

  1. In Eclipse, in the project you created in the first step, navigate to src/server and expand the content for the service that you want to build:
    pureweb.samples.[scribbleapp or asteroids]
  2. Double-click the service file ( or to open it.
  3. Create a run configuration by selecting Run | Run Configurations.
  4. Right-click Java Application and select New.
  5. Click the Run button to run the service.

    If the server is already running, you do not need to restart it. Instead, simply reload the plug-ins (navigate to the server's Configuration page and click the Reload Plugins button). Otherwise if the server is not running, start it now and log in.

    You should now see your sample service in the Apps page of the PureWeb server, under Available Managed Applications.