you have this error because you dont creat file java.io.FileNotFoundException: db.properties first step you must creat file by this code, for example: java.io.File file = new java.io.File("file.txt"); and then you can read from file by this code , for example : java.util.Scanner input = new java.util.Scanner(file); | 2 |
By: [email protected] On: Thu Nov 14 07:55:55 EST 2013 0 2 0 | 2 |
Are You Satisfied :9Yes3No |
Hi Ricky, The code which is write there is correct and it compile and run properly. just do one thing both "db.properties file & Test.java" in same folder and try to rum on command form it will run successfully. Check it............. | 0 |
By: [email protected] On: Thu Nov 14 13:38:17 EST 2013 0 0 0 | 0 |
Are You Satisfied :2Yes4No |
Both files db.properties & Test.java in same folder then On cmd i write javac Test.java it compile successfully but i write java Test it generates the exception then i getting the following error Exception in thread "main" java.io.FileNotFoundException: db.properties (The system cannot find the file spec fied) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileReader.<init>(Unknown Source) at Test.main(Test.java:12) tell me what i do | 0 |
By: [email protected] On: Thu Nov 14 20:55:15 EST 2013 5 0 0 | 5 |
Are You Satisfied :3Yes3No |
You can go for one more thing. Place the db.properties in a package and import that package. | 0 |
By: [email protected] On: Sat Nov 16 04:48:27 EST 2013 0 359 0 | 359 |
Are You Satisfied :2Yes2No |
You can mention the full path of properties file e.g. FileReader reader=new FileReader("c:\\mylocation\\file.properties"); You should save the properties file by using .properties in double quote. e.g. save by "db.properties" | 0 |
By: [email protected] On: Tue Nov 19 01:54:56 EST 2013 0 77 0 | 77 |
Are You Satisfied :2Yes0No |