Properties files in Applet

W

Willy Johnsson

Hello,

I would to my Applet support couple of dirrerent languages.
I tested standard porperties file that were included in applet's jar file
but didn't get it work.

Is it possible to package properties files to applet jar?
If yes how to call them?

Cheers!
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Willy said:
I would to my Applet support couple of dirrerent languages.
I tested standard porperties file that were included in applet's jar file
but didn't get it work.

Is it possible to package properties files to applet jar?
If yes how to call them?

Sure.

Something like:

Properties p = new Properties();
p.load(getClass().getClassLoader().getRessourceAsStream("path in jar");

Arne

PS: Shouldn't you use the special form of properties files known
as message bundles for this ?
 
A

Andrew Thompson

Willy Johnsson wrote:
....
I would to my Applet support couple of dirrerent languages.

Web start can deliver resources to applets and applications
according the the local PC and its settings (language etc.).
I tested standard porperties file that were included in applet's jar file
but didn't get it work.

Is it possible to package properties files to applet jar?
Yes.

If yes how to call them?

URL propertyLocation = this.
getClass().getResource("/path/to/app.properties");
System.out.println("propertyLocation: " + propertyLocation);
InputStream propertyStream = propertyLocation.openStream();

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 
R

Roedy Green

I would to my Applet support couple of dirrerent languages.
I tested standard porperties file that were included in applet's jar file
but didn't get it work.

see http://mindprod.com/jgloss/resource.html

For an example of use, see the holiday calculator which loads a text
list of holidays it supports or the In words calculator which loads a
list of languages it supports.

See http://mindprod.com/products1.html#HOLIDAYS
http://mindprod.com/products1.html#INWORDS

For customising an app to a particular language see
http://mindprod.com/jgloss/internationalisation.html
and chase the links.

Sun has special tools for customising a big app to different locales
and automatically selecting the correct customisations.
 
A

Andrew Thompson

Roedy Green wrote:
...
Sun has special tools for customising a big app to different locales ..

'locales' (slaps forehead) I should have thought to mention
that as a 'search term' - also 'internationalization'.
But then.. I am guessing the mindprod pages mention most
of the key terms, and have plenty of links back to relevant
resources.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200710/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top