Commons VFS和Java.net.URL-添加对"sftp://"的支持协议 [英] Commons VFS and Java.net.URL - Adding support for "sftp://" protocol
问题描述
我们正在尝试使用 Apache Commons VFS 通过SFTP访问某些内容. 它声称支持SFTP ,但是我们得到了 java.net.URL
.但是文档告诉我它实际上并不支持sftp://
URL.
We're trying to use Apache Commons VFS to access something over SFTP. It claims to support SFTP, however we're getting a MalformedURLException when it starts. Digging around I see that apache vfs is using java.net.URL
. However the documentation tells me that it doesn't actually support sftp://
URLs.
以下路径的协议处理程序保证在搜索路径中存在:-
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
.
I'm using java 1.6.0 on Linux. How can I prevent java.net.URL
from throwing a wobbly when it sees a sftp://
URL? I need to keep using the Apache commons VFS library, which uses java.net.URL
.
推荐答案
请参见依赖项 commons-vfs要求sftp才能工作.一旦 JSch 位于类路径中,您的异常将不再发生.看看 Apache的Wiki ,了解通过sftp进行连接的示例.
See the list of dependencies that commons-vfs requires for sftp to work. Once JSch is in the classpath, your exception no longer happen. Have a look at Apache's Wiki for examples of connecting via sftp.
这篇关于Commons VFS和Java.net.URL-添加对"sftp://"的支持协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!