Adding mixed case registry values when using Java. - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jreflections
Posts: 3
Joined: Sun Jul 19, 2009 7:46 am

Adding mixed case registry values when using Java.

It turns out that the Java java.util.prefs.Preferences class does not support capital letters. If it finds one it precedes it with a / which causes problems when I am searching for a variable added by Advanced Installer. For example, if my product name is 'MyQueryTool', it is added as 'MyQueryTool'. If I attempt to retrieve it Java looks for '/My/Query/Tool/' so I can't find the associated value.

Here is an example of a Java created key - "/E/M/A/I/L_/A/D/D/R/E/S/S". The Advanced Installer equivelant would be "EMAIL_ADDRESS".

This means that I can't directly use the provided [Manufacturer][ProductName] tree node unless both names are lower case only. Is there a way I can get around this?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Adding mixed case registry values when using Java.

Hello,

A possible solution to your problem would be using a property to store a version of your product name with the uppercase letters preceded by the '/'. You could achieve this creating a new property, ProductNameJava, then assigning it with the proper value, in two ways:
- either by creating a new property, say ProductNameJava, giving it the product name with the '/' preceded uppercase letters as the value
For example using /My/Query/Tool as the value for ProductNameJava, then searching for MyQueryTool in your Java application.
- or by creating a property [ProductNameJava] and assigning it the value of [|ProductName], then creating a custom action that automaticaly adds the '/' to your [ProductNameJava] property.

If you want to use the latter, you should make sure that the custom action is executed right after the 'Begin' standard action, both in the InstallUISequence and in the InstallExecuteSequence.
You would then add this property in the Registry, and use it's unparsed version, which is the original name of your product, in your Java application.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
jreflections
Posts: 3
Joined: Sun Jul 19, 2009 7:46 am

Re: Adding mixed case registry values when using Java.

I spent alot of time trying to figure out why I couldn't find the registry entries created using the default "[Manufacturer][ProductName]" properties. Instead I just hard coded in all lowercase letters which works fine. My only suggestion is that the documentation and/or tool warns Java users so they can avoid the hassle.

Thanks for the great product!

Return to “Common Problems”