sbo*_*lla 1 java file-io file maven
如果我这样做
fis = new FileInputStream(new File(".").getAbsolutePath() + "/sudoinput.txt");
Run Code Online (Sandbox Code Playgroud)
它试图写入服务器上的这个位置。我不确定这是否是一个可写的地方。
FILE NAME (fos)::::::::::::::::::/opt/tomcat/temp/./sudoinput.txt
FILE NAME (fis)::::::::::::::::::/opt/tomcat/temp/./sudoinput.txt
Run Code Online (Sandbox Code Playgroud)
我想写入 webapps/sudoku/WEB-INF/classes 基本上是 C:\Users...\git\sudo-project\sudo\src\main\resources
在 Eclipse Windows 7 上,如果我给出这个错误 src\main\resources\sudoinput.txt (The system cannot find the path specified)
fis = new FileInputStream("src/main/resources/sudoinput.txt");
Run Code Online (Sandbox Code Playgroud)
我也试过这个:
fis = new FileInputStream("src\\main\\resources\\sudoinput.txt");
Run Code Online (Sandbox Code Playgroud)
但不起作用。
我应该如何创建一个 fileinputstream 才能写入 src/main/resources ?请注意,我正在使用 eclipse windows 进行开发,如果这改变了需要指定路径的方式,我会将 .war 文件上传到 unix 服务器。
| 归档时间: |
|
| 查看次数: |
25875 次 |
| 最近记录: |