aspose file tools
The moose likes IDEs, Version Control and other tools and the fly likes Help finding database.properties file in Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply Bookmark "Help finding database.properties file in Eclipse" Watch "Help finding database.properties file in Eclipse" New topic
Author

Help finding database.properties file in Eclipse

Unnsse Khan
Ranch Hand

Joined: Nov 12, 2001
Posts: 511
Hello,

I am using MySQL 5 and Eclipse 3.1 on OS X Tiger.

Created the following file (TestDB.java), in Eclipse:



I also added a database.properties file (using Eclipse):



Now, when I right mouse clicked on my project and went to 'Java Build Path',
I added the following jar:

mysql-connector-java-3.1.12-bin.jar

When I tried to run the program using "Run As Java Application", I got the following exception in the Console:

java.io.FileNotFoundException: database.properties (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at TestDB.getConnection(TestDB.java:78)
at TestDB.runTest(TestDB.java:50)
at TestDB.main(TestDB.java:22)

Why couldn't Eclipse detect this file? I created it in Eclipse, so I wonder why it couldn't find its location...

Many, many thanks!
Rajagopal Manohar
Ranch Hand

Joined: Nov 26, 2004
Posts: 183
That is strange.

Does the database.properties file reside in the project folder or the source folder

If it is the latter try moving it to the project folder.

A better solution would be to put it into your source folder and get your input stream using this.class.getResourceAsStream("/database.properties");

-Rajagopal
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Help finding database.properties file in Eclipse
 
Similar Threads
java -jar [error] unable to access jarfile postgresql-8.4-702.jdbc.3.jar
NullPointerException
jdbc-odbc bridge problem