File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes read properties file from web.xml or  through java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "read properties file from web.xml or  through java" Watch "read properties file from web.xml or  through java" New topic

read properties file from web.xml or through java

arun kumar bv

Joined: Sep 08, 2011
Posts: 3
hi all,

I have a java web app. I want to specify the path in file is as shown below:


when i run the application it is showing filenot found exception my java code is like this:

public class ConfigLoader {

public String Uploadphotokey="PhotoFileDir";
public String Uploadhoroscopekey="HoroscopeFileDir";
private static Properties prop =new Properties();

public String getProperty(String key){
ConfigLoader config =new ConfigLoader();
System.out.println("inside configureloader if control******************");

return prop.getProperty(key);
private void loadProperty(){
FileInputStream inStream;
Properties prop =new Properties();

try {
System.out.println("loading successfully");
inStream = (FileInputStream) getClass().getResourceAsStream("");


catch (FileNotFoundException e) {
catch (IOException e) {


public static void main(String[] args) {
File photofile = new File(FileFolder);
FileOutputStream fout1 = new FileOutputStream(photofile);

can anybody please help me how to read this through web.xml or from java code or any means.
thanks in advance

It is sorta covered in the JavaRanch Style Guide.
subject: read properties file from web.xml or through java
Similar Threads
Related String
Can't call ejb 3.1 form app client project in jboss 6.0 final
Problem in wrtitng JAR File
copy file from init()
ServletContext and properties file