Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Relative Paths in Java Program

807588Apr 1 2009 — edited Apr 1 2009
Hi All,

In one of the java programs i am trying to read a properties file using the Properties class
Please find the code below
private static final String magicPropFile = "config.prop";
Initial.magicProps = new Properties();
Initial.magicProps.load(new FileInputStream(Initial.magicPropFile));

This throws a FileNotFoundException

I have placed the file in the same directory as the .java files. I am using Eclipse IDE. The files are placed in a package com.xyz.sample

All the .java and the prop files are in the same directory

It works fine when i give the absolute path from my Desktop.

Can anyone tell me that is the file placed properly or any change in the code that needs to be done?

Rgds
Aditya
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 29 2009
Added on Apr 1 2009
11 comments
659 views