0

我试过这个:

URI uri = URI.create( "file://servername/e$/somefile" );
File file = new File(uri);

但它抛出:

java.lang.IllegalArgumentException: URI has an authority component
4

2 回答 2

1

Use a Windows style path (with a leading triple slash):

File file = new File("\\\\\\server\\e$\\somefile");
于 2012-07-18T01:17:49.210 回答
1

使用带有-style URL 的JCIFSsmb://[[[domain;]username[:password]@]server[:port]/[[share]] ,或者有一天你会醒来,尝试从不同的操作系统运行你的应用程序,并发现“一次编写,随处运行”的概念比你想象的还要有趣。

于 2012-07-18T01:31:15.400 回答