wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Parse suncertify.properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Parse suncertify.properties" Watch "Parse suncertify.properties" New topic

Parse suncertify.properties

Martin Wallgren

Joined: Jan 24, 2008
Posts: 6
In my URLyBird assignment there is a requirement to have suncertify.properties in the current working directory.

How can I add current working directory to class path without breaking the assignment must about no other arguments than the ones specified are allowed?

Maybe there is an easy way of opening this file as a ResourceBundle even though it's not on the class path?

EDIT: no worries. Found the solution by my self. If anyone else have this question here's what I did.

URL[] url = new URL[] { new File(System.getProperty("user.dir")).toURL() }; // Current working directory

SUNCERTIFY_RESOURCE_BUNDLE = ResourceBundle.getBundle("suncertify", Locale.getDefault(), new URLClassLoader(url));
[ February 24, 2008: Message edited by: Martin Wallgren ]

SCJP 5.0 2007-11-21<br />SCJD (working on URLyBird 1.2.3)
Thomas Heiss

Joined: Feb 20, 2008
Posts: 9
Dear Martin, dear valued rancher,

Why did you choose to implement reading the file suncertify.properties with the ResourceBundle classes?

Personally I am going for (or at least I want to) with java.util.Properties.

But what I did not find:
Java Util class to read key/value pairs per section.

So what I would like to have is three sections in suncertify.properties:
SERVER.host (optional if RMI supports multi network homed servers)



Properties seems to read all keys into ONE HashMap.
I would have to implement the filtering on SERVER/STANDALONE/CLIENTSERVER on my own (what a crap and this is not spec conform as java JDK classes will be preferred by SUN).

Ranchers: Is there any way to read the whole Props file per section in a Properties instance out of the box?

Best regards


Technical J2EE Solution Consultant<br /> - Specialist for Middleware and Messaging solutions --<br />Certified SCJP 5.0, SCBCD 1.3, SCEA I (SCJD, SCEA II/III running)
I agree. Here's the link: http://aspose.com/file-tools
subject: Parse suncertify.properties