我们正在尝试使用Apache Commons VFS来访问SFTP上的内容。它声称支持SFTP, 但是当它启动时,我们遇到了一个MalformedURLException异常。仔细查看后发现,Apache VFS正在使用
java.net.URL
。然而,文档告诉我它实际上并不支持sftp://
URL。
Protocol handlers for the following protocols are guaranteed to exist on the search path :-
http, https, ftp, file, and jar
Protocol handlers for additional protocols may also be available.
我正在Linux上使用Java 1.6.0。当java.net.URL
看到一个sftp://
的URL时,我该如何防止它抛出异常?我需要继续使用Apache commons VFS库,该库使用java.net.URL
。