• 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
Re: Loading a configuration file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading a configuration file


  • Subject: Re: Loading a configuration file
  • From: Colin Clark <email@hidden>
  • Date: Thu, 30 Oct 2003 10:12:03 -0500

Hi Greg,

System properties generally need to be set with the -D flag. From "java -help":

    -D<name>=<value>
                  set a system property

Hope that helps,

Colin

On Wednesday, October 29, 2003, at 11:31 PM, Greg Hulands wrote:

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.


---
Colin Clark
Dynamic Web/Database Developer
Resource Centre for Academic Technology,
University of Toronto
(416) 946-7592 / email@hidden
_______________________________________________
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.

References: 
 >Loading a configuration file (From: Greg Hulands <email@hidden>)

  • Prev by Date: multithreading and stateless components
  • Next by Date: Re: WO 5.2.2 - Getting an app to launch - java.lang.NoClassDefFoundError
  • Previous by thread: Loading a configuration file
  • Next by thread: Applets in WO
  • Index(es):
    • Date
    • Thread