简体   繁体   中英

relative path to deployed resources Tomcat 7

I have the following project structure

在此处输入图片说明

Is it possible to access usersDev.json via relative path? when I try with this JsonReader jsonReader = new JsonReader(new FileReader("src\\\\main\\\\webapp\\\\static\\\\usersDev.json")); It can not find the file. Any help is appreciated.

Never try to read resources from inside an application with File . Use getResourceAsStream() instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM