Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

MIDlet: How to read configuration?

Thread view: 
Simon Brooke - 11 Oct 2006 18:05 GMT
OK, I'm trying to learn how to build a MIDlet. I'm an experienced
server-side Java programmer, but I'm new to Micro Edition. The problem I'm
looking at just now is how do I read configuration for the MIDlet at
startup time?

In the MIDlet package as I understand it, I don't have java.io.File, and I
don't have java.util.Properties, so I can't do

       Properties config = new Properties()
       config.load( new FileInputStream( new File( CONFIGFILENAME)));

I have a whole variety of configuration variables which I don't want to
hardcode in the MIDlet, and which it isn't reasonable to expect the user
to key in on some crappy mobile phone keypad each startup. So there must
be an easy way to do this...

I need the configuration file to be easy to maintain, so a simple text file
like a Java properties file stored in a resource seems to me the best
solution.

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

       Morning had broken, and there was nothing we could do but wait
       patiently for the RAC to arrive.

Simon Brooke - 12 Oct 2006 13:57 GMT
> OK, I'm trying to learn how to build a MIDlet. I'm an experienced
> server-side Java programmer, but I'm new to Micro Edition. The problem
> I'm looking at just now is how do I read configuration for the MIDlet at
> startup time?

D'oh!

Just in case anyone does a google search on this question some time in the
future, the answer is you store config as name/value pairs in the
application descriptor (jad) file, and access them using

       getAppProperty( String)

See
http://developers.sun.com/techtopics/mobility/midp/ttips/getAppProperty/

I have to say I discovered this after /completely/ reinventing the wheel
using rms.

Sorry for asking damn fool questions.

Signature

simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/

       ;; Diplomacy, American: see Intelligence, Military



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.