简体   繁体   English

将文本文件放在Web应用程序中的位置

[英]where to put the text file in web application

I have email manager and I load the email contents from the text files. 我有电子邮件管理器,并且从文本文件加载电子邮件内容。 I load the text files from the class path. 我从类路径加载文本文件。 When I test in the java SE environment, it works well. 当我在Java SE环境中进行测试时,它运行良好。 When I used the email Manager in web application, I got the FileNotFoundException . 在Web应用程序中使用电子邮件管理器时,出现FileNotFoundException I would like to know where can I put the text files to load successfully in web application? 我想知道如何将文本文件放在Web应用程序中成功加载?

Edit 编辑

In the email manager, 在电子邮件管理器中,

FileReader fr = new FileReader("EmailContent.txt");

项目结构

WebContent应该是正确的位置,而无需定义适用于tomcat的路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Intellij 中放置文本文件的位置 - Where to put text file in Intellij 具有Enunciate的Web应用程序:放置静态资源的位置 - Web application with Enunciate: where to put the static resources 我应该在web应用程序(maven项目)中将java.util.logging的logging.properties文件放在哪里? - Where should I put logging.properties file for java.util.logging in web application (maven project)? 将ServiceLoader配置文件放在Web应用程序中的位置 - Where to put ServiceLoader config file in a web app 使用NetBeans在JSP Project中放置文本文件的位置 - Where to put a text file in JSP Project with NetBeans 在Java Web应用程序中将sql2java.properties放在哪里? - Where to put sql2java.properties in Java web application? 在非Web应用程序中将Spring applicationContext.xml放在哪里? - Where to put Spring applicationContext.xml in a non-web application? Bluemix Liberty Web应用程序的配置数据存放在哪里 - Where to put configuration data for a Bluemix Liberty web application JSP Web应用程序需要在哪里放置“ dat”文件 - Where to put 'dat' files need by JSP Web Application 将CSS和javascript文件放在Gradle Java Web应用程序中的位置 - Where to put css and javascript files in gradle java web application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM