Java 文件路径的分隔符

原路径:

Windows: D:\Users\beyond

Linux:  /home/xh/Videos

转换后路径:

Windows: D:\\Users\\beyond

Linux:  /home/xh/Videos

或:

Windows: D:/Users/beyond

Linux:  /home/xh/Videos

解决方法:

1. 直接换成/ ;

2. System.getProperty(“file.separator”)

猜你喜欢

转载自bugyun.iteye.com/blog/2278227