We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

javapda on 07/01/07


Tagged

sun properties SPOT MANIFESTMF


Versions (?)


Sun SPOT getting properties from MANIFEST.MF


Published in: Java 


Shows how to access properties in the resources/META-INF/MANIFEST.MF file. Presumably this file would have an entry like the following: NameOfFile: winners.txt The following code accesses this property at runtime from within the MIDlet and prints it to the console.

  1. public class GetAppPropertiesSpotApp extends MIDlet {
  2.  
  3. protected void startApp() throws MIDletStateChangeException {
  4.  
  5. String nameOfFile=this.getAppProperty("NameOfFile");
  6. System.out.println("NameOfFile=" + nameOfFile);
  7.  
  8. }
  9. protected void pauseApp() {}
  10. protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}
  11. }

Report this snippet 

You need to login to post a comment.