Properties files in Applet

Discussion in 'Java' started by Willy Johnsson, Oct 18, 2007.

  1. 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!
    Willy Johnsson, Oct 18, 2007
    #1
    1. Advertising

  2. Willy Johnsson wrote:
    > 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 ?
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Oct 19, 2007
    #2
    1. Advertising

  3. 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
    Andrew Thompson, Oct 19, 2007
    #3
  4. Willy Johnsson

    Roedy Green Guest

    On Thu, 18 Oct 2007 22:04:59 +0300, "Willy Johnsson"
    <> wrote, quoted or indirectly quoted someone who
    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.


    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.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Oct 19, 2007
    #4
  5. 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
    Andrew Thompson, Oct 19, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Love

    applet vs. canvas in applet

    Rob Love, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    605
    Liu, Chunyen
    Jul 7, 2003
  2. webster
    Replies:
    0
    Views:
    841
    webster
    Jul 20, 2003
  3. Andrew Thompson
    Replies:
    0
    Views:
    402
    Andrew Thompson
    Aug 5, 2003
  4. Blah Blah
    Replies:
    0
    Views:
    1,419
    Blah Blah
    Aug 13, 2003
  5. Jade
    Replies:
    3
    Views:
    914
    Roedy Green
    Aug 14, 2003
Loading...

Share This Page