我正在阅读一些 RMI 文档,所有书籍都说我们需要为客户端创建 Stub 以便与服务器通信。 但是,我试图不创建 stub ,而且一切都很顺利。我将客户端程序放在一台机器上,将服务器放在另一台机器上,一切正常。 那么,创建 Stub 的实际目的是什么?我们真的需要创建一个吗? 谢谢。
最佳答案
从 Java 1.5 开始,您不必:
This release adds support for the dynamic generation of stub classes at runtime, obviating the need to use [...] stub compiler, rmic, to pregenerate stub classes for remote objects. Note that rmic must still be used to pregenerate stub classes for remote objects that need to support clients running on earlier versions.
来自 http://download.oracle.com/javase/1.5.0/docs/guide/rmi/relnotes.html
关于java - 我们真的需要在 java RMI 中创建 Stub 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5537091/