Launching RAP Applications from the IDE

The RAP Tools provide two dedicated launchers to start RAP applications directly from the IDE: the RWT Launcher, used for snippets and stand-alone applications, and the RAP Launcher, used for applications based on OSGi. The latter you can also be started without the RAP Tools, using the plain OSGi Launcher.

Contents:

Using the RWT Launcher

The RWT Launcher is the simplest way to start a RAP application. It requires no OSGi, application configuration or Branding, only an entry point. Consequentially, this method does not allow multiple entry points or any customization of the application (e.g. using a custom theme).

  1. Select the Java class that contains the entry point you want to launch (e.g. in the Package Explorer).
  2. Select Run > Run As > RWT Application in the menu bar, or Run As > RWT Application in the context menu of the file.
  3. The application will be launched and opened in a browser view.

Before the RWT launcher starts the application, it terminates any possibly running instance of the same application. After a successful start, you should see a message like this one in the Console view:
INFO: Started SocketListener on 0.0.0.0:<port>.

Further launch configuration options

Whenever you start an application as described above, a launch configuration is created and added to the Run > Run History menu. The created launch configuration is based on your Java project and your IDE preferences. It can later be edited and refined with custom or additional parameters.

To create a new launch configuration or to alter an existing one, select Run > Run Configurations… or Run > Debug Configurations…. This opens a dialog that lets you create, modify, and delete launch configurations of different types. To create a new RWT Application launch configuration, select RWT Application from the list of launch configuration types on the left, and press the New button in the toolbar. The tabs on the right allow you control specific aspects of the launch.

On the Main tab you can control the following aspects of the launch:

For an explanation of the other tabs see the topic Creating a Java application launch configuration

Using the RAP Launcher

The RAP Launcher is based on the OSGi Launcher and adds a Main tab page to it. Please note that the RAP Launcher only works when the Equinox OSGi Framework is selected, which is the default setting on page Bundles.

Open in Browser

This setting lets you control whether the application should be opened in a browser after a successful start. The application can be opened either in an internal browser, i.e. embedded in the Eclipse IDE, or in an external browser. The external browser application can be configured in the Web Browser preference of your IDE, the link Configure browsers… lets you jump right there.

The Servlet Path field lets you configure the URL that will be opened in the browser. Which path is mapped to which entry point is configured in the application configuration.

Server Settings

Use a fixed port configuration lets you select a fixed network port to start your application at. If you don't configure a port, the launcher will choose a free port, which may be different on every launch.

Session Timeout specifies the servlet session timeout in seconds. If the checkbox is unselected, the session will never expire.

Context Path selects an optional context path for the web application. The context path is part of a web application's URL, e.g. http://<server>:<port>/contextPath/servletPath. In a servlet container, every webapp is available at its own context path. This setting lets you simulate the same context path that your application will be accessible at in the production environment.

The option Start in development mode selects the variant of the RWT JavaScript library that will be delivered to the client. If development mode is on, the client maintains the JavaScript code in its original, human-readable form. If it is off, the client is optimized for speed and size by compressing the JavaScript code. It will also print non-critical JavaScript errors to the browsers console instead of crashing the entire client.

Instance Area

The instance area location sets the Program Arguments to define the osgi.instance.area. Bundles use this location to store their state location data.

Required plug-ins

In the Bundles tab, the following bundles need to be activated:

Basic RAP bundles

Basic Equinox OSGi platform

The Jetty servlet container

Servlet API (remove when deploying to a servlet container)

Optional RAP bundles (require additional platform bundles - see below)

Eclipse platform bundles required by applications using JFace or the Workbench (only a subset may be required, please check for the actual dependencies)

To launch an existing launch configuration you may use the launch shortcut keys Alt+Shift+X, R (run) and Alt+Shift+D, R (debug).

Using the OSGi Launcher

Alternatively, you can also use the plain OSGi Launcher to start RAP applications. In this case, you have to set the necessary system properties and program arguments on your own. At minimum, you have to specify the HTTP port for the server with this VM argument:

-Dorg.osgi.service.http.port=<PORT>

To run RAP in development mode, add this system property, too:

-Dorg.eclipse.rap.rwt.developmentMode=true

Context path

To simulate the production environment, you can start your application with a context path, e.g. http://localhost:8080/contextPath/servletName.

-Dorg.eclipse.equinox.http.jetty.context.path=<context path>

Valid context paths start with a slash and do not end with a slash. In the example above, the context path would be /contextPath. The default is the root context, i.e. the URL does not contain a contextPath segment.

Servlet engine log

By default the servlet engine (namely Jetty) is configured to suppress most logging information. This can be changed by adding this VM argument to the launch configuration:

-Dorg.eclipse.equinox.http.jetty.log.stderr.threshold=<log level>

Valid log levels are debug, info, warn, error, and off. The default value is warn.

TroubleShooting