Re: Loading a configuration file
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.