File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Parse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Parse" Watch "Parse" New topic


Martin Wallgren

Joined: Jan 24, 2008
Posts: 6
In my URLyBird assignment there is a requirement to have 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 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
[SERVER] (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:
subject: Parse
It's not a secret anymore!