Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

J2ME Properties

J2ME lacks the java.util.Properties class. Although it is possible to put application settings in the JAD file this is not recommended for many properties. (Since, some platforms limits the size of JAD file.) I want to put a configuration file inside my jar file and parse it. And I do not want to go with XML because it will be overshooting for my case.

Question is, is there an already existing library for J2ME that can parse properties files or something similar such as INI file. Or would you recommend another method to solve the initial problem?

like image 736
Szere Dyeri Avatar asked Aug 05 '26 17:08

Szere Dyeri


1 Answers

The best solution probably depends on what is going to be generating the properties files.

If you've got other non-JavaME projects using the same properties files, then stick with them, and write or find a parser. (There is a simple one from GoBible available on Google Code)

However you might find it just as easy to keep your configuration as static final String myproperty="myvalue"; in a Configuration.java file which you compile, and include in the jar instead, since you then do not need any special code to locate, open, read, and parse them.

You do then pick up a limitation on what you call them though, since you can no longer use the common dot separated namespacing idiom.

like image 83
Stephen Denne Avatar answered Aug 08 '26 08:08

Stephen Denne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!