简体   繁体   English

罐子中的类名冲突?

[英]Conflicting class name in jars?

This might sound stupid but is it possible to access classes with same name in 2 jars based on some condition. 这听起来可能很愚蠢,但是可以根据某些条件在2个jar中访问相同名称的类。

My problem is i want to make a standalone java program where in i can connect to my old and new maximo systems through RMI 我的问题是我想制作一个独立的Java程序,在其中我可以通过RMI连接到我的新旧maximo系统

i am able to access both systems independently but for data migration i need to access both in same class. 我能够独立访问两个系统,但是为了进行数据迁移,我需要在同一个类中访问这两个系统。 Biggest problem is both old and new jar files have same name 最大的问题是旧的和新的jar文件都具有相同的名称

Is there any way i can refer to 1st jar in one method and second one in other method? 有什么方法可以在一种方法中引用第一个jar,而在另一种方法中引用第二个jar?

Thanks 谢谢

You can use custom class loader. 您可以使用自定义类加载器。 here is the link for details. 这是详细信息的链接 just to quote your issue it says 只是引用你的问题说

... In fact, these applets can contain classes of the same name -- these classes are treated as distinct types by the Java Virtual Machine. ...实际上,这些小程序可以包含相同名称的类-Java虚拟机将这些类视为不同的类型。

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

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