简体   繁体   English

通过Java在OS X上读取文件-我的路径正确吗?

[英]Reading a File on OS X via Java - Is my path correct?

I am trying to do this 我正在尝试这样做

File file = new File("/Users/Jon/Downloads/mynewalbum/artist - title.mp3");

I don't think its correct though as the properties returned don't seem correct. 我不认为它是正确的,因为返回的属性似乎不正确。 Maybe I have got a backslash or something wrong? 也许我有一个反斜杠或出了点问题?

Try File.exists() to see whether the file exists. 尝试File.exists()以查看文件是否存在。 If the path is wrong, the file will not exist. 如果路径错误,该文件将不存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM