Java - Relative path of a file in a java web application

前端 未结 6 2012
星月不相逢
星月不相逢 2020-11-29 23:55

I want to read a file from a java web application. I don\'t want to give the absolute path of the file. I just want to put the file in some directory of my web application.<

6条回答
  •  感动是毒
    2020-11-30 00:43

    there is another way, if you are using a container like Tomcat :

    String textPath = "http://localhost:8080/NameOfWebapp/resources/images/file.txt";
    

提交回复
热议问题