Reputation: 4568
I'm having a problem with creating shortcuts at versions of WindowsXP that aren't in English.
I want to add a shortcut to the 'Startup' menu, that way, the application will run every time the user log on.
So i did:
<shortcut online="true">
<desktop/>
<menu submenu="Startup"/>
</shortcut>
But, at WindowsXP in Portuguese, for example, the correct submenu need to be 'Inicializar' instead of 'Startup'.
So, considering that application's users may have English or Portuguese versions of Windows, I need something like that:
<shortcut online="true">
<desktop/>
<menu submenu="Startup"/>
</shortcut>
<shortcut online="true">
<desktop/>
<menu submenu="Inicializar"/>
</shortcut>
But that doesn't work.
Can anyone help?
Thanks.
Upvotes: 2
Views: 507
Reputation: 31
I did this in my app:
public static void main(String[] args) {
IntegrationService is = null;
String osName = System.getProperty("os.name");
try {
is = (IntegrationService) ServiceManager.lookup("javax.jnlp.IntegrationService");
} catch (UnavailableServiceException use) {
use.printStackTrace();
}
if (!is.hasMenuShortcut()) {
if (osName.equals("Windows 7")) {
is.requestShortcut(false, true, "Startup");
} else {
is.requestShortcut(false, true, "Inicializar");
}
}
SystemTrayTest main = new SystemTrayTest();
}
So in Windows XP the shortcut is created in "Inicializar" and Windows 7 in "Startup".
Upvotes: 3
Reputation: 168825
The JNLP format supports partitioning downloads by locales in the resources
elements, but not the shortcuts
element (from memory - use JaNeLA to check for sure).
Instead, you will probably need to look to the IntegrationService
introduced in 6.0.18. Particularly the requestShortcut(desktop,menu,submenu)
1 method. The method returns a boolean
to indicate success/failure.
submenu
might be inferred from:
user.language
Locale.getDefault()
Upvotes: 3