0

My code is not able to read the property file. Can anyone help here? It prints unable to find the file.

BufferedReader br = null;
String strLine = "";
try {
    br = new BufferedReader( new FileReader("C:/common-test/common-test/translationtest/messages_ja.property"));
    while( (strLine = br.readLine()) != null){
        System.out.println(strLine);
    }
} catch (FileNotFoundException e) {
    System.err.println("Unable to find the file: fileName");
} catch (IOException e) {
    System.err.println("Unable to read the file: fileName");
}
Nayuki
  • 17,911
  • 6
  • 53
  • 80
puchu
  • 69
  • 1
  • 9
  • change `/` to `\\` and also escape them – Ramanlfc Feb 22 '16 at 17:23
  • 1
    I strongly recommend printing the actual Exception instead of your own custom output. That will give you far more information (like why it's not working). – Hypino Feb 22 '16 at 17:24
  • 1
    What exception do you get? Please use this code `catch(IOException e) { e.printStackTrace(); }` and show us the error message – Nayuki Feb 22 '16 at 17:25

1 Answers1

0

Try to use this \\:

 "C:\\common-test\\common-test\\translationtest\\messages_ja.property"

Are you sure to use .property or .properties.

Abdelhak
  • 8,299
  • 4
  • 22
  • 36