0

Possible Duplicate:
Load properties file in Servlet/JSP

I was wondering how to access a property file from a Java class,where this project is done using Java EE,because the stacktrace keeps giving me this message(is it because that folder is inaccessible?).The question is: How to access a property file from a Java class in Java EE?

Here is the code:

In UserClient.java:

        Properties config = new Properties();
        config.load(new FileInputStream("C:/Users/L31207/Desktop/FYPJ/OpenCalais/MarcusFYPJ"));
        String[][] categories = fetchArrayFromPropFile("content", config);


Here is the stacktrace:

        java.io.FileNotFoundException: C:\Users\L31207\Desktop\FYPJ\OpenCalais\MarcusFYPJ (Access is denied)
Community
  • 1
  • 1
Marcus Dryice Koh
  • 117
  • 1
  • 2
  • 13

2 Answers2

0

Just because you are using a program to open the file doesn't mean you can completely ignore the security measures your operating system has in place. The "user" running the program doesn't have permissions to open this file.

That is why your "reason" in the stack trace is "Access is denied". Perhaps you can actually open this file, but your program running as the user it is running as cannot.

Edwin Buck
  • 69,361
  • 7
  • 100
  • 138
0

EDIT:Silly me,what Yogendra Singh says is right.I did not specify the file name,only the folder name.

Marcus Dryice Koh
  • 117
  • 1
  • 2
  • 13