Following up on my previous question concerning the Windows 7 taskbar, I would like to diagnose why Windows isn\'t acknowledging that my application is independent of
If you just need to set the AppUserModelId then the above JNA code is enough. However if you want to take advantage of the new Windows 7 features in you Java application then check out J7Goodies a Java library providing Windows 7 taskbar extensions.
EDIT: more info from J7Goodies Programmer's Guide
4.2. Setting AppUserModelID
In order to use any of the Windows 7 features an application must explicitly set its process identifier – Application User Model ID (
AppUserModelID). It can have no more than 128 characters and cannot contain spaces. Each section should be camel-cased, for example:CompanyName.ProductName.SubProduct.VersionInformationThis identifier must be set before any GUI (window) is shown. You set it by calling:
// Remember to set AppUserModelID before creating any UI
AppUserModelId.setCurrentProcessId("StrixCode.J7Goodies.Appname");
4.3. Setting Window Properties
A Java application cannot be pinned to the Windows 7 taskbar unless its window properties are defined. The properties consist of four fields:
- AppUserModelID – the same as passed to
AppUserModelId.setCurrentProcessId(String)- RelaunchDisplayName – application’s name
- RelaunchCommand – the full command used to launch the application. In case of a Java program it will be:
-jar - RelaunchIcon – path to application’s icon
Important:
RelaunchCommandandRelaunchDisplayNamemust always be set together. To set these properties use the straightforward WindowProperties class.
WindowProperties props = new WindowProperties(myFrame);
props.setRelaunchCommand("");
props.setRelaunchDisplayName("My Java Application");
props.setRelaunchIcon("");
props.setAppUserModelID("StrixCode.J7Goodies.Appname");
props.save();