• Post Reply Bookmark Topic Watch Topic
  • New Topic

Read file from runme.jar  RSS feed

 
Wilder C Rodrigues
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I making some tests in my assignment and when I started the client in another computer and I found some problems in time to read my suncertify.properties and other files from runme.jar.
I'm doing so:
URL url = getClass().getClassLoader().getResource("suncertify.properties");
URI uri = new URI(url.toString());

Properties props = new Properties();
props.load(new FileInputStream(new File(uri)));
String className = (String)props.get("LOOK_AND_FEEL");
if(className != null){
UIManager.setLookAndFeel(className);
}

I think when I use "props.load(new FileInputStream(new File(uri)));" the system tries to find the file in the system files and not in the runme.jar.
What I have to do?
Thanks,
Wilder
 
Arun Kumar
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant remember the exact words given in the instruction. But the idea is, the suncertify.propeties file should be in your currentworking directory regardless of where your runme.jar file is.
Arun
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!