This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Kubernetes in Action and have Marko Luksa on-line!
See this thread for details.
Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Parse  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!