Results 1 to 4 of 4
- 02-03-2009, 01:21 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 3
- Rep Power
- 0
Adding property or config files to a project
using eclipse 3.4.1 Ganymede
want to add property files to the project such as log4.properties and other .properties files. Created a folder config_deploy under the project in project tree. Project is deployed to a geronimo server added to server view, but error says cannot find .property file. What is the proper way to add .properties files to Eclipse?
- 02-03-2009, 05:34 PM #2
Place your resources (.properties included) in a directory under the src folder. Eclipse will copy this to the bin folder. For example, if your root package name looks like
src/com/mycompany/thisapplication
add a directory
src/com/mycompany/thisapplication/resources
and put everything in there.
At this point, everything can be accessed through the application classpath. Do not use absolute path names, but remember to use the full name of the resource, i.e.
com/mycompany/myapplication/resources/resource.name
See ResourceBundle.getBundle() for .properties, ClassLoader.getSystemResource() for other resources.
- 02-03-2009, 07:14 PM #3
Member
- Join Date
- Oct 2008
- Posts
- 3
- Rep Power
- 0
Thanks for your post!! I moved the .properties file under the src directory and it works! :)
I have seen people put .properties files in folders outside of source, beneath the project in the project tree. Do you know how this is done?
- 02-03-2009, 07:34 PM #4
Java doesn't care where you put your .properties file; it just wants a location.
The reason I said to put it under src is that it becomes part of the project and can always be found using the classpath, including when it's *deployed*.
If you put the .properties outside the classpath, then you have to find it some other way, which is a problem when you deploy your application.
Similar Threads
-
Adding existing items to a project
By Katherine in forum EclipseReplies: 4Last Post: 01-20-2009, 04:23 AM -
DOAP files (description of a project)
By turtleboy in forum XMLReplies: 0Last Post: 11-05-2008, 01:54 PM -
Eclipse adding $1.class files
By eboraks in forum EclipseReplies: 1Last Post: 11-28-2007, 04:35 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks