将项目迁移到 Servlet - 属性文件
我正在将一个项目迁移到 servlet。 我将 jar 放在 lib 目录中,将编译后的类放在 classes 目录中。 但是,我正在应用程序中加载和读取一些文件(属性、wsdl 文件)。例如,这就是我加载属性的方式:
try {
InputStream in = new BufferedInputStream(new FileInputStream("my.prop"));
myConfig.load(in);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
我正在加载的那些文件去了哪里?
I am migrating a project to a servlet.
I put the jars in the lib directory, the compiled classes in classes directory.
However, I have some files (properties, a wsdl file) that I am loading and reading in my application. For example this is how I am loading my properties:
try {
InputStream in = new BufferedInputStream(new FileInputStream("my.prop"));
myConfig.load(in);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
Where do those files that I am loading go?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们通常直接进入类路径,这样您就不会依赖于本地磁盘文件系统的当前工作目录。但是您必须改变获取输入流的方式:
另请参阅:
They usually go straight in the classpath so that you aren't dependent on the current working directory of the local disk file system. But you've got to change the way how you're getting an inputstream:
See also: