我试过这个:
URI uri = URI.create( "file://servername/e$/somefile" );
File file = new File(uri);
但它抛出:
java.lang.IllegalArgumentException: URI has an authority component
我试过这个:
URI uri = URI.create( "file://servername/e$/somefile" );
File file = new File(uri);
但它抛出:
java.lang.IllegalArgumentException: URI has an authority component
Use a Windows style path (with a leading triple slash):
File file = new File("\\\\\\server\\e$\\somefile");
使用带有-style URL 的JCIFSsmb://[[[domain;]username[:password]@]server[:port]/[[share]]
,或者有一天你会醒来,尝试从不同的操作系统运行你的应用程序,并发现“一次编写,随处运行”的概念比你想象的还要有趣。