windows和linux文件路径问题
2018-02-24 11:23
344 查看
1、
windows平台:用\或\\
linux平台:用/
2、
Java代码中路径分隔符用:File.separator
3、
windows平台也兼容/,也可以统一替换成/
filePath = filePath.replace("\\", "/");
4、路径错误会报错,No Such file or diretory异常
java.io.FileNotFoundException: /home/tomcat/apache-tomcat-7.0.68_HXConsloe/webapps/HXConsole/JCB\\JCB_MerchantDataFile_20170905100340.txt (No such file or directory)
windows平台:用\或\\
linux平台:用/
2、
Java代码中路径分隔符用:File.separator
3、
windows平台也兼容/,也可以统一替换成/
filePath = filePath.replace("\\", "/");
4、路径错误会报错,No Such file or diretory异常
java.io.FileNotFoundException: /home/tomcat/apache-tomcat-7.0.68_HXConsloe/webapps/HXConsole/JCB\\JCB_MerchantDataFile_20170905100340.txt (No such file or directory)
相关文章推荐
- python复制文件,路径不存在问题(Windows和linux路径分隔符不统一)
- windows与linux中文件路径分隔符问题解决--通过File.separator解决掉此问题
- windows与linux中文件路径分隔符问题解决
- windows和Linux路径问题:File.separator 文件路径
- 关于File.separator 文件路径:windows与linux下路径问题 ("\"与"/")
- Linux和windows的文件路径问题
- Java文件路径问题小记(Windows & Linux)
- windows与linux中文件路径分隔符问题解决
- javaweb文件上传路径在windows和linux上的兼容性问题
- windows与linux中文件路径分隔符问题解决
- java linux和windows下文件路径间隔符的写法——解决linux下程序在windows下运行时的上传文件出错问题
- Linux下gcc编译中关于头文件与库文件搜索路径相关问题(三)
- linux和windows系统互拷文件乱码问题
- 在LINUX下,struts 2 文件上传路径问题
- Windows环境下编译linux文件遇到的问题
- Linux下gcc编译中关于头文件与库文件搜索路径相关问题 3
- Linux下gcc编译中关于头文件与库文件搜索路径相关问题
- linux与windows c++的文件路径
- Windows和Linux下文件路径的解决办法
- 在LINUX下,struts 2 文件上传路径问题