Article View: borland.public.jbuilder.java.language
Article #19163Re: Saving Java programs settings?
From: Spectron International, Inc.
Date: Fri, 27 Feb 1998 00:00
Date: Fri, 27 Feb 1998 00:00
35 lines
1708 bytes
1708 bytes
The best way is to use a Properties class. It works just like an INI file
(more or less).
Is derived from Hashtable so you just have to do the following:
Properties prop=new Properties();
// sets a property called LastProject to c:\jbuilder\...
prop.put("LastProject","c:\jbuilder\myprojects\TestApp\TestApp.jpr");
// sets a property called LastLoaded to c:\jbuilder\...
prop.put("LastLoaded","c:\jbuilder\myprojects\TestApp\TestAppFrame.java");
The properties class has a Save method. I think it takes an InputStream.
I think the Load method will do all the parsing for you.
Check the help, because I don't remember now. :)
Fawzib H. Rojas
Spectron International, Inc.
James D. Frentress wrote in message <34F71B69.2F4F0CDA@ForAWhile.com>...
>Dana Scott Kaufman wrote:
>
>> What is the best way to save settings a Java program will use to
>> configure itself each time it runs?
>>
>
>if it isn't an applet, store the file where you want. a text file is
>nice to use because you can easily edit it. you can also use a
>ResourceBundle or other structure. StreamTokenizer makes the text file
>parse easy.
>
>jim
>
>
Technical Details
Message-ID:
<6d7978$8lp5@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34F6EFF8.F88BE2DD@ix.netcom.com> <34F71B69.2F4F0CDA@ForAWhile.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,bde2fada64d4d4f8 X-Google-Attributes: gidf74b3,public From: "Spectron International, Inc." <spectron@caribe.net> Subject: Re: Saving Java programs settings? Date: 1998/02/27 Message-ID: <6d7978$8lp5@forums.borland.com> X-Deja-AN: 329258092 References: <34F6EFF8.F88BE2DD@ix.netcom.com> <34F71B69.2F4F0CDA@ForAWhile.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language