java - Get reosurce in a modular project -


i'm working on maven modular project has structure @ following:

|-- parent     |-- model     --pom.xml     |-- services     --pom.xml     |-- web-app     --pom.xml 

no in service module have resources in src/main/resources. when try them:

string filename = getclass().getresource("/myfile.txt").getpath(); map.put("myreport",jaspercompilemanager.compilereport(filename)); 

the file name has following value

file:/home/myuser/apache-tomcat-8.0.3/webapps/myapp/web-inf/lib/services-0.0.1-snapshot.jar!/myfile.txt

and when try use :

caused by: java.io.filenotfoundexception: file:/home/myuser/apache-tomcat-8.0.3/webapps/myapp/web-inf/lib/services-0.0.1-snapshot.jar!/myfile.txt 

also saw others post (not resolved) get file in resources folder in java said not possible resource different modules.

is true? how can fix it?


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -