• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1485
  • Last Modified:


 I am working on standalone application using Netbeans. This is not web and desktop application
 This is java application
 I have created AppConfig.properties file and is created on the root of the source packages
 My system is not reading the file AppConfig.properties
 I have also tried it movong into the folder where main file exists
 But no luck. I donot wanted to hardcode path within the application
 The Error message says
 java.io.FileNotFoundException: AppConfig.properties (The system cannot find the file specified)
       at java.io.FileInputStream.open(Native Method)
       at java.io.FileInputStream.<init>(FileInputStream.java:106)
       at java.io.FileInputStream.<init>(FileInputStream.java:66)
       at mccprocesswatcher.Main.readRegistrationXMLs(Main.java:50)
      at mccprocesswatcher.Main.main(Main.java:42)

Please help me to fix this

Many Thanks
Properties properties = new Properties();
try {
	properties.load(new FileInputStream("AppConfig.properties"));
	String strPropertyValue = properties.getProperty("FtpDirectoryPath");
	mL.info("Property Read: "+strPropertyValue);
} catch (IOException e) {
    mL.error("Property file not read: " ,e);

Open in new window

1 Solution
Try the following. Place the file in the directory which is the parent of your package tree
InputStream in = getClass().getResourceAsStream("/AppConfig.properties");

Open in new window

If "AppConfig.properties" file is place at
root of "compile class folder" then it should be fine.
tia_kamakshiAuthor Commented:
Many Many Thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now