简体   繁体   English

java.net.MalformedURLException:未知协议:rsrc

[英]java.net.MalformedURLException: unknown protocol: rsrc

I get this; 我明白了

java.net.MalformedURLException: unknown protocol: rsrc

I'm not entirely sure what to do about this unknown protocol. 我不确定要如何处理这个未知协议。 I am using simple RMI to communicate between two JVMs. 我正在使用简单的RMI在两个JVM之间进行通信。 Is it a jar that I am missing that contains this protocol and, if so, which one? 我是否缺少一个包含此协议的jar,如果是,则是哪个协议? I haven't found Google searches to be all that great for this issue. 我还没有发现Google搜索能很好地解决这个问题。

Any help would be appreciated. 任何帮助,将不胜感激。 Thanks. 谢谢。

EDIT2: To clarify, my RMI code works when running from Eclipse. EDIT2:澄清一下,从Eclipse运行时,我的RMI代码有效。 It's when I export and use runnable jar files and such that it breaks. 就是在我导出并使用可运行的jar文件时,它会中断。

EDIT: Here's a code snippet: 编辑:这是一个代码段:

registry=LocateRegistry.getRegistry(
                rmiServerAddress,
            (new Integer(rmiServerPort)).intValue());

I finally figured it out. 我终于弄明白了。 When using Eclipse and exporting a runnable jar file, make sure to choose under Library Handling: 使用Eclipse并导出可运行的jar文件时,请确保在“库处理”下选择:

Extract required libraries into generated JAR

That will fix this particular issue and probably many others. 这将解决此特定问题,并可能解决许多其他问题。

此选项绝对有效: Export > Runnable Jar File > Copy required libraries into a sub-folder

Sorry, it's already too late on this side of the globe and I missed the your phrase! 抱歉,在地球这端已经为时已晚,我想念您的话了! :-) What about this issue ? :-)那这个问题呢? Basically, is the server running from a path in the filesystem with spaces in the pathname? 基本上,服务器是从文件系统中的路径(路径名中带有空格)运行的吗?

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

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