PDA

View Full Version : Reading a .properties(or any file) within the Dialogs



veldrain
05-31-2004, 07:15 PM
Hi,

I have a Properties file
which a dialog reads from
<snippet of properties code>
InputStream iStream = MyClass.getResourceAsStream("p.properties");
Properties prop = new Properties();
prop.load(iStream);
String str = prop.getProperty("Prop1");
</snippet of properties code>

It's all good so far; however, what i'm stuck at is packaging the p.properties file. I try to place in it the \src\com\installshield\prj\event\dialog\swing directory but the file isn't include during a build.

So the question is how do i include the properties file in the install?

Thanks in advance.

-Veldrain

mholland
06-02-2004, 12:54 PM
I was trying to use a resource bundle in my project as well and got the following help from support:

--------------------------------------
If you need to pass in the arguments you will have to create your own resource bundles and add it to the project at Installation Designer -> Media -> Releases -> Language Support. Basically if you have used Multiplatform 5.03 it is the same way to create resource bundles. You can create properties file one for each language you support and then one property file as the base file.

You will need to put these properties file in the Universal Installer -> classes folder of your InstallShield X home directory. I am attaching MyPropertiesBundle here. Please let me know if you need further assistance regarding this.
-------------------------------

Basically, you can create a .properties file, put it in the proper place, let installshield know about it, and then access it within your code. To access it, you use:
$L(<your bundle name>,<id of entry>[,argument,argument,argument...]).

In java, you would use:
String resource = context.getServices().resolveString("$L argument from above");

mike.

veldrain
06-02-2004, 01:36 PM
Hi Mike,

Thanks for the insight. Works very well after your suggestion!

wohler
10-06-2004, 08:37 PM
Hi Mike,

I must be unclear as to what InstallShield thinks is a resource bundle.

When I went to View List > Media > Releases > Language Support and clicked on Add Resource Bundle as you suggested, I entered com.newt.strings and got an error about it not being a valid bundle. I put tried com/newt/strings.properties, com/newt/strings_en.properties, com/newt/strings/strings_en.properties.

/opt/InstallShield/X/classes/com is a link to my com directory and InstallShield is happily finding actions there.

Thanks for any help you can provide.

InstallShield X Universal Primier.