java.net.MalformedURLException: 未知协议: rsrc
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7507156/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.net.MalformedURLException: unknown protocol: rsrc
提问by AlbertoPL
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. Is it a jar that I am missing that contains this protocol and, if so, which one? I haven't found Google searches to be all that great for this issue.
我不完全确定如何处理这个未知的协议。我使用简单的 RMI 在两个 JVM 之间进行通信。它是我缺少的包含此协议的 jar,如果是,是哪个?我还没有发现谷歌搜索对这个问题非常有用。
Any help would be appreciated. Thanks.
任何帮助,将不胜感激。谢谢。
EDIT2: To clarify, my RMI code works when running from Eclipse. It's when I export and use runnable jar files and such that it breaks.
EDIT2:澄清一下,我的 RMI 代码在从 Eclipse 运行时有效。当我导出和使用可运行的 jar 文件时,它就会中断。
EDIT: Here's a code snippet:
编辑:这是一个代码片段:
registry=LocateRegistry.getRegistry(
rmiServerAddress,
(new Integer(rmiServerPort)).intValue());
回答by AlbertoPL
I finally figured it out. When using Eclipse and exporting a runnable jar file, make sure to choose under Library Handling:
我终于弄明白了。使用 Eclipse 并导出可运行的 jar 文件时,请确保在 Library Handling 下选择:
Extract required libraries into generated JAR
That will fix this particular issue and probably many others.
这将解决这个特定问题,可能还有许多其他问题。
回答by Rafael Cordones
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?
对不起,在地球的这一边已经太晚了,我错过了你的短语!:-)这个问题呢?基本上,服务器是否从文件系统中的路径运行,路径名中有空格?
回答by Evan Hu
this option definitely works: Export > Runnable Jar File > Copy required libraries into a sub-folder
这个选项绝对有效: Export > Runnable Jar File > Copy required libraries into a sub-folder