java rmi stub,我们真的需要在java RMI中创建Stub吗?

从Java 1.5开始,不再需要预先生成Stub类来实现客户端与服务器之间的通信。现在,运行时可以动态生成Stub,使得远程对象的调用更加便捷。然而,如果需要支持早期版本的客户端,仍然需要使用rmic编译Stub。这个转变简化了Java RMI的使用流程,但同时也需要注意兼容性问题。
摘要由CSDN通过智能技术生成

I am reading some RMI document and all the books say that we need to create Stub for the client in order to communicate with the server.

However, I have tried to not create stub and things worked like a charm. I have put the client program on one machine and the server on another, things worked perfectly.

So, what is actually the purpose of creating Stub and do we really need to create one?

Thanks.

解决方案

Since Java 1.5 you don't have to:

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值