Access from Java to Tomcat paths -



have webapp running in local tomcat. path is: tomcat/webapps/myproject.
have resources in project in folder path: tomcat/webapps/myproject/resources

so, trying acces resources java project, using file config.properties. in file have this:

tomcat.url= http://localhost tomcat.port=8080 tomcat.resources=/myproject/resources 

i tryed different combinations of / or \ error running project:

trying acces directory not exist 

my java code:

configuration config = new propertiesconfiguration("config.properties");     string sourcepath = config.getstring("tomcat.resources"); //and try list folder   file dir = new file(sourcepath); string[] children = dir.list();          if (children == null) {               // either dir not exist or not directory     throw new serviceexecutionexception("trying generate metadata in directory not exist");                   }  

i don't know wrong, in projects made before, simliar this, had similar , found everything.
ideas?? in advance.

the file must located @ tomcat/webapps/myproject/src/main/resources check update.

i don't know how accessing file, in case i'd recommend use propertiesconfiguration

 private static final string configuration_path = "config.properties";  propertiesconfiguration configuration = new propertiesconfiguration(configuration_path); 

edited

the problem trying open file located (keeping in mind "/" root file system) @ /myproject/resources when file located @ (probably) /var/lib/tomcat6/webapps/myproject/resources.

you can real path of file using servletcontext#getrealpath


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -