FileInputStream 在哪个文件夹中查找?

编程入门 行业动态 更新时间:2024-10-21 13:44:00
本文介绍了FileInputStream 在哪个文件夹中查找?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我用线

FileInputStream stream = new FileInputStream("myfile.properties");

在不指定路径的情况下打开属性文件.

to open a properties file without specifying a path.

在 Apache Tomcat 上运行时,找不到该文件.我将文件放入应用程序的根文件夹中.

When running it on Apache Tomcat, the file can not be found. I placed the file into the root folder of the application.

Java 在哪个文件夹中查找?

In which folder is Java looking?

我无法更改路径,因为代码不是我的.

I can not change the path because the code is not by me.

推荐答案

它会在文件夹中查找

System.getProperty("user.dir")

这可能在任何地方.这取决于tomcat服务器启动时的当前工作目录.

and this could be anywhere. That depends the current working directory when the tomcat server is started.

如果您无法从标准日志或 tomcat 启动过程中找出答案,请尝试加载一个小的 servlet,在加载时打印该信息.

Try to load a small servlet that prints that info at loading if you cannot figure out from standard logs or the tomcat start procedure.

这篇关于FileInputStream 在哪个文件夹中查找?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 04:17:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1389320.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   夹中   FileInputStream

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!