All screen casts now with HTML5 video

We've just converted all our screen casts to HTML with MP4 and WebM codecs so you can enjoy them on mobile and other Flash-less devices.


There still is a Flash fallback for ancient browsers that do not support the "video" tag. Some older browsers (such as Firefox 3) that support the video-tag but do not support either the MP4 or the WebM video codec may show an error. In that case, please go to our youtube channel to watch the screen casts.

Migrating to install4j 5.1

The following new features in the install4j 5.1 require consideration when migrating from 5.0:

New architecture for elevated privileges


install4j 5.1 introduces a new architecture for elevated privileges. Under some circumstances this can create backwards compatibility problems with your existing projects that are discussed below.

Prior to install4j 5.1, the the "Request privileges" action could restart the entire installer process and run the installer GUI and all the actions with elevated privileges. This was the default setting on Windows and also available on Mac OS X. The unelevated process was kept around only for starting launchers and other executables without privileges. On Mac OS X, the default mode for the "Request privileges" action was to start an elevated helper process that was used internally by some actions - such as the service actions. The strategy of running the GUI without elevated privileges is a lot better, but our helper process had very limited capabilities and so it could not be made the default on Windows.

Enter install4j 5.1: We have now removed the "restart" and beefed up the elevated helper process considerably. Single actions can now be executed in the elevated helper process. To this end, we have added an "Action elevation type" property to all actions in the install4j IDE. Unless the action declares a different default value, it is set to "Inherit from parent". The "Action elevation type" is also configurable on screens, installer applications, screen groups and action groups, and determines the default value for the contained actions.

If an action is set to be executed with maximum available privileges and an elevated helper process has been started by the "Request privileges" action, the action is serialized to the elevated helper process, executed there and then serialized back to the unelevated process. In the elevated helper process, it has access to all installer variables and it can interact with the GUI through the methods in the com.install4j.api.Util class. Elevated actions in console installers can use all methods in the provided com.install4j.api.screens.Console object to interact with the user.




If you are just using standard actions, migrating to install4j 5.1 should not break anything. If you use custom code, the two-process architecture and the changed default privileges might impact your installer. Here are the points that you should look at:

  • Using static state in elevated actions may have unintended consequences, since static state is not synchronized between the two processes. Only use installer variables for saving state.
  • Elevated actions must be serializable. The base interface for actions now extends java.io.Serializable, but all contained objects must be serializable as well, otherwise a fatal error will occur.
  • Installer variable values should be serializable. If you place a non-serializable value into an installer variable, you will not be able to use it in elevated actions.
  • If your action previously assumed that it would have full privileges, you have to set its "Action elevation type" to "Elevate to maximum available privileges" manually. For example, a "Run script" action that modifies a file with your own code may not work on a file in the installation directory unless you elevate the action. For custom actions, you can call setFullPrivilegesRequired or setDefaultActionElevationType in your action bean info in order to automatically set the correct elevation type in the install4j IDE when the action is inserted.
  • Some methods in the API do not work in the elevated helper process. They have been marked to throw NotSupportedInElevationException in the API javadoc. Mainly this concerns methods in the context that change the control flow (i.e. jump to another screen) or methods that modify the GUI. If your action needs to use these methods while at the same time requiring elevation, you can always use context.runElevated(...) to push a piece of code to the elevated helper process.

 The key advantages of the new architecture are:
  • Unified privileges architecture for Windows and Mac OS X
  • No more problems due to user change on authentication
  • Privileges can reasonably be requested at any point in the installer, not only at the beginning
  • Better desktop integration of the installer GUI, for example for drag and drop

Support for OpenJDK on Mac OS X 

OpenJDK is the way forward for Java applications on Mac OS X. However, the following points need your attention:

  • It is not possible to deliver an installer or a single bundle archive that support both the old Apple JRE as well as OpenJDK. The stubs are different and you choose either option in the media wizard. Old projects will keep the Apple JRE option, so nothing will change by default
  • JRE bundling on Mac OS X is only supported for Open JDK
  • The minimum Java version for OpenJDK is Java 7 and the minimum Mac OS X version is 10.7.3. So you can currently target only newer systems and only if your application supports Java 7.

Code signing for Windows and Mac OS X

Code signing on Windows and Mac OS X is now implemented in pure Java code which works on any supported platform. Previously, install4j only offered a hook for inserting an external code signing tool for Windows which would be executed for each launcher and installer application. This functionality is still available for Windows media files and is now called "Executable processing". So your existing solution for code signing will still work and there is no immediate need for action.

However, if you have .pvk and .spc files for your code signing certificate, you can enter them on the General Settings->Code Signing tab and enable Windows code signing there. You then have to remove the external code signing command on the "Executable processing" step of the media wizard.

Attaching to Windows services for Java profiling

Several profilers can attach to running JVMs, but only JProfiler can attach to Windows services. It is very easy to do:

1.Start "Quick attach":



2. All JVMs are shown that run with your user account. Select the "Show services" button at the top:


 3. Select your service:


4. Profile!

Using the probe tracker

This screen cast shows how the probe tracker can be used to record fine-grained chronological information for selected hot spots and control objects, such as JDBC connections. The probe tracker is available for all probes in JProfiler.

Profiling JPA/Hibernate

The screen cast below shows the capabilities of the JPA/Hibernate probe in JProfiler. It presents the events view of the probe that shows a chronological progression of persistence operations as well as the hot spots view that shows back traces and associated JDBC statements.

Default locale changes in Java 7

In the last Windows versions of install4j, we recently introduced some changes to improve how installers choose the default language and to mirror the new locale features in Java 7.

New language settings in Java 7

Until Java 7, a Java application retrieved the default locale from the Formats tab in the Region and Language Windows control panel, as shown below.


Even if this dialog box and other Windows dialogs are in English, a Java application running under Java 6 and previous versions will choose here German and Germany as default language and country, and this settings will end up in the user.language and user.country System properties, and thus in the default Locale object. This might seem surprising at first, but language settings are often used to set the default Java formats for numbers and dates, so this actually makes sense.

Java 7 introduced new Locale concepts that are initialized from the Display Language setting shown below.


In Java 7, the information coming from these two different settings ends up in the following new system properties:

user.language.format
user.language.display
user.country.format
user.country.display

These properties are used to initialize the default locales - plural, because there are now 3 default locales! The old one returned by Locale.getDefault(), and the two new ones returned by Locale.getDefault(Locale.Category.DISPLAY) and Locale.getDefault(Locale.Category.FORMAT). The two latter ones reflect the two Windows languages settings above and are used in different contexts. As you can guess, Locale.getDefault(Locale.Category.FORMAT) will be used now in default Java formats.
But the first time you'll run your program under Java 7, you will see that its user interface will use the language chosen in the Display Language Windows setting - a change from previous Java versions. Actually, the default language in Swing look and feel still depends on the locale returned by Locale.getDefault(), but this locale is derived from Locale.getDefault(Locale.Category.DISPLAY).
To help you understand these changes, let's run the following test application:

import java.text.DateFormat;
import java.util.*;

public class ShowLanguageAndLocale {
  public static void main(String [] args) {
    String [] messages = {
        // language and country System properties                          
        "user.language = "          + System.getProperty("user.language"),
        "user.country = "           + System.getProperty("user.country"),
        "user.language.display = "  + System.getProperty("user.language.display"),
        "user.country.display = "   + System.getProperty("user.country.display"),
        "user.language.format = "   + System.getProperty("user.language.format"),
        "user.country.format = "    + System.getProperty("user.country.format"),
        // default locales
        "default locale = "         + Locale.getDefault(),
        "default display locale = " + Locale.getDefault(Locale.Category.DISPLAY),
        "default format locale = "  + Locale.getDefault(Locale.Category.FORMAT),
        // date test
        "Date: " + DateFormat.getDateInstance(DateFormat.FULL).format(new Date())};
    javax.swing.JOptionPane.showMessageDialog(null, messages);
  }
}

Under a Windows system configured in German for the Formats settings and English for the Display language settings, this application will show this dialog:


As expected, the title of the dialog box and the display language are in English, whereas the date and the format language are in German.

If you don't want this behavior in your application with Java 7 (for backward compatibility reasons for example), you can still force the old language settings based on the format language, by setting the new sun.locale.formatasdefault property to true.
When run with the following command:


java -Dsun.locale.formatasdefault=true ShowLanguageAndLocale

the previous application will display the following dialog box where the default locale is initialized from the FORMAT locale (note that the value of the DISPLAY locale is not lost):


Default language choice in install4j

install4j has a native part that also performs a language auto-detection that must be in sync with the default locale of the JVM. Since install4j 5.0.11, we handle this in the following manner: As many of you are still running their installers with Java 6 or a previous version, and don't want an unintentional change of behavior the day you'll support Java 7, we set the sun.locale.formatasdefault System property to true by default. If you run your application with Java 6, this won't change its behavior at all; if you run it under Java 7, this means that your application select the same locale as with Java 6.

As some of you might prefer the new choice made by Java 7, we also added the ability to pass the new -Dsun.locale.formatasdefault=false parameter to installers and launchers. This parameter will make them initialize their language and country from the Display Language setting whatever Java version they run with.


For more information about the Locale changes in Java 7, please read the new section about Locale scope in the Java tutorial.

Profiling with IntelliJ IDEA 11

As always, we try to provide an IntelliJ IDEA plugin immediately when a new major version of IDEA is released.

Most of the time, a release of IDEA does not coincide with a JProfiler release, so we release the plugin separately in the plugin manager. To install the JProfiler plugin in IDEA (both community and ultimate editions), click on "Browse repositories" in the plugin manager and look for "JProfiler".

The plugin will be bundled in the upcoming JProfiler 7.1 release.

Update (2012-01-16): By mistake, the plugin version (different from the JProfiler version) decreased from 10.3 to 10.2, so many update problems were caused by this. Now the plugin version has been increased to 11.0 and the update should work if you had 10.2 or 10.3 installed previously.