Documentation Contents
Java Platform, Standard Edition Deployment Guide
Contents    Previous    Next

4 Application Startup

This topic provides information about the application startup process, user experience, and customization options.

The user experience is an important factor in making an application successful. The deployment of an application creates a user's first impression, and impacts the user's satisfaction with the application.

In this topic, the default experience for users of Java and JavaFX applications is explained, and the options for customizing the user experience are presented. This topic contains the following sections:

4.1 User Experience Considerations

Users are easily annoyed if they are unable to start an application, do not understand what are the next steps, perceive the application as slow or hung, and for many other reasons.

Default Java packaging takes care of many problem areas including:

  • Ensuring the user has the required JRE installed

  • Auto installing missing dependencies or offering to install them as needed

  • Providing visual feedback to the user while the application is being loaded

  • Showing descriptive error messages

For example, when users do not have Java installed and double-click the JAR file for your application, they see a dialog box explaining that they need to download and install the JRE.

Developers have a wide range of options on how to tune the experience for their users, such as:

  • Show your own splash screen

  • Use a custom loading progress indicator

  • For Java FX applications, customize the messaging (for example, explain to users why they need to install the JRE in a language other than English)

4.2 Application Startup Process, Experience, and Customization

The following sections describe the transition phases of application startup, how users experience those phases, and how the default visual feedback to the user can be customized.

4.2.1 Startup Process

Between the time an application is started and the time the user sees the main dialog, a sequence of events occurs on screen while operations are carried out in the background. Figure 4-1 shows these activities and describes them in the following paragraphs. This startup sequence partially depends on the execution mode and on the speed with which the background operations complete. Figure 4-1 shows a series of boxes that depict the background operations over time, including screen shots of what the user sees as these operations occur for a JavaFX application.

The application startup process has the following phases:

  • Phase 1: Initialization

    Initialization of the JRE and an initial examination of the application identifies components that must be loaded and executed before starting the application. The initialization phase is shown in the first two boxes in the upper row in Figure 4-1.

  • Phase 2: Loading and preparation

    The required resources are loaded from either the network or a disk cache, and validation procedures occur. For JavaFX applications, all execution modes show either the default or a custom progress bar. This phase is shown in the third box in the upper row in Figure 4-1.

  • Phase 3: Application-specific initialization

    The application is started, but additional resources might need to be loaded or other lengthy preparations performed before the application becomes fully functional. For example, it might be necessary to check if elevated permissions are needed and to display the appropriate request for permission to the user.

  • Phase 4: Application execution

    The application is shown and is ready to use after the background operations shown in Figure 4-1 are finished.

4.2.2 Default User Experience

A properly packaged application provides default visual feedback to the user for the first two phases for all execution modes. The actual behavior depends on the execution mode and type of application.

When launched in standalone mode, most applications start quickly, and no visual feedback is required.

Table 4-1 summarizes the default behavior according to execution mode when the application is launched for the first time and is loaded from the network.

Table 4-2 summarizes the default behavior for subsequent launches, in which the JAR files are loaded from the cache. In this case, the process has fewer visual transitions because nothing needs to be loaded from the network during the Loading Code phase, so launch time is substantially shorter.

4.2.3 Customization Options for JavaFX Applications

The splash screen for embedded applications is displayed in the web page and can be easily customized by using an onGetSplash callback, as shown in Section 19.2.3, "onGetSplash."

The default JavaFX preloader can be customized by using a CSS style sheet, similar to other JavaFX components. Pass the customized style data using the javafx.default.preloader.stylesheet parameter for your application. The following items are valid for the parameter:

  • Absolute or relative URI of the CSS style sheet, either as a text file with a .css extension, or in binary form with a .bss extension. For more information about binary conversion, see Section 5.4, "Style Sheet Conversion."

  • Actual CSS code.

To customize the preloader, use the .default-preloader class. In addition to standard CSS keys, the preloader has the following special keys:

  • -fx-preloader-status-text

    Status text shown in the preloader

  • -fx-preloader-graphic

    Absolute or relative URI of the image used by the preloader

Example 4-1 shows an example of CSS file my.css:

Add the style sheet to the <fx:deploy> Ant task as shown in Example 4-2:

If only a few customizations are needed, pass CSS code instead of a file name, to avoid the overhead of downloading a file. Example 4-3 shows how to change the background color to yellow.

To add a company logo to the default JavaFX preloader, you could pass the following string as a value of the javafx.default.preloader.stylesheet parameter :

".default-preloader { -fx-preloader-graphic:url
(''); }"

If customizing the default JavaFX preloader is not enough and you need a different visualization or behavior, see Chapter 13, "Preloaders for JavaFX Applications" for information about how to implement your own preloader, and see Chapter 5, "Packaging Basics" for information about how to add the custom preloader to your package.

4.3 Helping Users Start the Application

In some cases, a user might have difficulty getting your application to run. For example, the following situations could cause an application to fail:

  • The user has an unsupported platform.

  • The user's system does not have the JRE installed.

  • Java is not configured correctly, for example the proxy information is not set.

  • The user declined to grant permissions to an application.

  • The application does not meet current security requirements.

It is important to plan for users who experience problems, by either providing guidance to resolve the issue or having the application fail gracefully and explaining to the user why it cannot be resolved.

The following sections describe methods for handling some common issues.

Contents    Previous    Next

Oracle and/or its affiliates Copyright © 1993, 2015, Oracle and/or its affiliates. All rights reserved.
Contact Us