• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Loading a configuration file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading a configuration file


  • Subject: Loading a configuration file
  • From: Greg Hulands <email@hidden>
  • Date: Thu, 30 Oct 2003 14:31:29 +1000

I am trying to get my wo application to load a configuration file on
startup. I have placed the xml config file in my home directory
(/Users/ghulands/config.xml) but for some reason the wo app never loads
it. It is getting a null pointer exception. I have appended the
arguments with -config /Users/ghulands/config.xml

public Application()
     {
         super();
         System.out.println("Welcome to " + this.name() + "!");

         String configFile = System.getProperty("config", null);

         if (configFile != null)
         {
             try {
                 WOXMLDecoder xDecoder = WOXMLDecoder.decoder();
                 configuration =
((NSDictionary)xDecoder.decodeRootObject(new NSData(new
FileInputStream(configFile), 1024))).mutableClone();
             }
             catch (Exception e){
                 System.out.println("Unable to load configuration file:
" + configFile);
                 loadDefaults();
             }
         }
         else
         {
             System.out.println("No configuration file provided.");
             loadDefaults();
         }

     }

Is there an issue with file permissions when running a wo app?

Any help is appreciated,
Greg
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Loading a configuration file
      • From: Colin Clark <email@hidden>
  • Prev by Date: Re: WO 5.2.2 and CodeSense,
  • Next by Date: Re: WO 5.2.2 - Getting an app to launch - java.lang.NoClassDefFoundError
  • Previous by thread: Re: WO 5.2.2 and CodeSense,
  • Next by thread: Re: Loading a configuration file
  • Index(es):
    • Date
    • Thread