Java 6 VM调用Java 4 VM

时间:2021-01-18 17:17:45

I've inherited a very old application that hasn't been upgraded because it depends on a third party library that is dependent on Java 4.

我继承了一个尚未升级的非常旧的应用程序,因为它依赖于依赖于Java 4的第三方库。

Getting rid of this third party library isn't going to happen in the near future as a critical part of the system is dependent on it.

摆脱这个第三方库不会在不久的将来发生,因为系统的关键部分依赖于它。

I want to bring the Java version of the application up to date and am thinking of moving the dependent jar into its own VM and then having some kind of call between the Java 6/7 VM and the Java 4 VM.

我想让Java版本的应用程序更新,并考虑将依赖jar移动到自己的VM中,然后在Java 6/7 VM和Java 4 VM之间进行某种调用。

First thoughts are to use RMI. Obvious first question is compatibility between VMs when using different Java versions. The third party lib produces byte streams so the returned data won't be affected by serialization. The data passed in can be manipulated into something that can be passed across if compatibility is an issue.

首先想到的是使用RMI。显而易见的第一个问题是使用不同Java版本时VM之间的兼容性。第三方lib生成字节流,因此返回的数据不会受序列化的影响。如果兼容性是个问题,传入的数据可以被操作成可以传递的内容。

Is this the right way to go?

这是正确的方法吗?

Are there better ways?

还有更好的方法吗?

1 个解决方案

#1


0  

  1. You can do a wrapper as Phillip said in a comment of yours... there are only some minor adjustments that you have to do in your old library
  2. 菲利普在你的评论中说,你可以做一个封装...你只需要在旧图书馆做一些小调整

  3. you can use RMI... it's safe! I tested it and it's a good approach... you don't have to change old messy code
  4. 你可以使用RMI ......这是安全的!我测试了它,这是一个很好的方法...你不必改变旧的凌乱的代码

  5. you can also use web services but I prefer RMI
  6. 你也可以使用网络服务,但我更喜欢RMI

If you have to modify something small and you have too many problems to change the JVM (because someone modified some jdk libraries [happened to me]) just leave it to java 4... :)

如果你必须修改一些小的东西,你有太多的问题需要更改JVM(因为有人修改了一些jdk库[发生在我身上]),只需将它留给java 4 ... :)

The problem I had was that I needed a library from jdk 1.5 to use in jdk 1.4 but my solution was to decompile the jdk 1.5 one and compile it back with jdk 1.4... because the old jdk had something modified in it... The problem I had on decompiled code is that I couldn't find a very good decompiler that knows about casting... and I had some * errors (but those are easy to fix)

我遇到的问题是我需要一个来自jdk 1.5的库在jdk 1.4中使用,但我的解决方案是反编译jdk 1.5并用jdk 1.4编译回来...因为旧的jdk在其中有一些修改...我在反编译代码上遇到的问题是我找不到一个非常好的反编译器,它知道有关转换...而且我有一些*错误(但这些很容易修复)

I hope my answer helps you

我希望我的回答可以帮到你

#1


0  

  1. You can do a wrapper as Phillip said in a comment of yours... there are only some minor adjustments that you have to do in your old library
  2. 菲利普在你的评论中说,你可以做一个封装...你只需要在旧图书馆做一些小调整

  3. you can use RMI... it's safe! I tested it and it's a good approach... you don't have to change old messy code
  4. 你可以使用RMI ......这是安全的!我测试了它,这是一个很好的方法...你不必改变旧的凌乱的代码

  5. you can also use web services but I prefer RMI
  6. 你也可以使用网络服务,但我更喜欢RMI

If you have to modify something small and you have too many problems to change the JVM (because someone modified some jdk libraries [happened to me]) just leave it to java 4... :)

如果你必须修改一些小的东西,你有太多的问题需要更改JVM(因为有人修改了一些jdk库[发生在我身上]),只需将它留给java 4 ... :)

The problem I had was that I needed a library from jdk 1.5 to use in jdk 1.4 but my solution was to decompile the jdk 1.5 one and compile it back with jdk 1.4... because the old jdk had something modified in it... The problem I had on decompiled code is that I couldn't find a very good decompiler that knows about casting... and I had some * errors (but those are easy to fix)

我遇到的问题是我需要一个来自jdk 1.5的库在jdk 1.4中使用,但我的解决方案是反编译jdk 1.5并用jdk 1.4编译回来...因为旧的jdk在其中有一些修改...我在反编译代码上遇到的问题是我找不到一个非常好的反编译器,它知道有关转换...而且我有一些*错误(但这些很容易修复)

I hope my answer helps you

我希望我的回答可以帮到你