更改java版本

发布于 2024-07-09 01:25:10 字数 126 浏览 10 评论 0原文

我有一个在 java 1.3 上运行的服务器-客户端应用程序; 我想逐步更改为java 1.6,这意味着首先是几个客户端,然后是其余的客户端,最后是服务器...... 我想知道您能否指导我解决一些可能出现的常见问题以及我应该注意什么?

i have a server - client application that runs on java 1.3; i want to change to java 1.6 step by step, meaning first few clients, than rest of the clients and finally server...
i was wondering could you direct me to some common problems that can come along and what should i look after?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

风铃鹿 2024-07-16 01:25:10

Sun 试图保持高水平的向后兼容性,因此您只需安装新的 JVM 并用它重新启动您的应用程序即可。

描述 Java 1.6 与早期版本的向后不兼容性的文档位于此处。 本文档链接了 Java 1.5Java 1.4 也是如此。 您可能想阅读此文档以了解可能的陷阱。

Java 1.5 和 Java 1.6 引入了新的类文件格式。 JVM 也将运行旧的类文件,但重新编译您的代码(尤其是使用 JDK 1.6)将帮助新 JVM 利用一些更改来使您的应用程序更快。 所以你可以考虑重新编译。

此外还引入了一些新的关键字,即assert(在1.4中)和enum(在1.5中)(正如Yuval已经提到的)。 如果您使用这些单词作为标识符,重新编译将失败,但旧的类文件将起作用。 您可以向 javac 提供开关 -source 以使其编译:“javac -source 1.3”将编译没有 assert的代码>enum 作为关键字。

Sun tries to keep a high level of backward-compatibility, so you possibly simply can install the new JVM and restart your application with it.

A document describing the backward-incompatibilities from Java 1.6 with earlier version is here. This document links the compatibility-documents for Java 1.5 and Java 1.4 as well. You probably want to read this documents to learn about possible pitfalls.

Java 1.5 and Java 1.6 introduced new class-file-formats. The JVM's will run the old class-files as well, but recompiling your code - especially with JDK 1.6 - will help the new JVM to take advantage of some changes to make your application faster. So you might consider recompiling.

Additionally some new keywords were introduced, namely assert (in 1.4) and enum (in 1.5) (as Yuval already mentioned). If you use these words as identifiers, a recompile will fail, but the old class-files will work. You can provide the switch -source to javac to let it compile: 'javac -source 1.3' will compile the code without assert and enum as a keyword.

习ぎ惯性依靠 2024-07-16 01:25:10

我突然想到,在字段和局部变量中查找名称 enumassert...这些词已成为 java 1.4 和 5 中的关键字。java 6如果编译器看到它们,会将它们标记为编译错误。

尤瓦尔=8-)

Off the top of my head, look for the names enum and assert in fields and local variables... These words have become keywords in java 1.4 and 5. The java 6 compiler will mark them as compilation errors if it sees them.

Yuval =8-)

花开半夏魅人心 2024-07-16 01:25:10

Sun 保留了每个新版本的 Java 引入的不兼容性列表。

1.4.2 的最后一个文档包含指向兼容性说明回到 JDK 1.0。

Sun keeps a list of incompatibilities that are introduced with each new version of Java.

The last document for 1.4.2 has links to the compatibility notes back to JDK 1.0.

巴黎夜雨 2024-07-16 01:25:10

总的来说,Sun JVM 的向后兼容性非常好,但并不完美。 我见过三个非常大的应用程序从 1.3 迁移到 1.5,并且只遇到了一小部分问题,其中最大的问题是一个 Swing 掩码进入无休止的事件处理循环,并在 1.4 下冻结了应用程序。

服务器部分不太可能会引起问题,但是 Swing 中发生了相当大的底层变化,特别是在 1.3 和 1.4 之间 - 例如,焦点子系统被完全重写。

该应用程序仍然有可能运行没有问题,但您绝对应该进行广泛的测试。

Generally, the backwards compatibility of Sun's JVMs is very good, but not perfect. I've seen three very large applications migrate from 1.3 to 1.5 and encounter only a small number of problems, the biggest of which was one Swing mask going into an endless event handling loop and freezing up the app under 1.4

The server part is unlikely to cause problems, but there have been pretty big under-the-hood changes in Swing, especially between 1.3 and 1.4 - the focus subsystem was completely rewritten, for example.

It's still possible that the app will run without problems, but you definitely should do extensive testing.

不甘平庸 2024-07-16 01:25:10

当我在我开发的一个小程序上从 1.4.2 迁移到 1.5 时,很多事情都出了问题:屏幕刷新变得不稳定、元素移动等等。Sun

的 JRE 不保持对所有内容的向后兼容性。 。 有时,当某些项目被弃用时,它们会在很短的时间内完全消失。

我们用“普通”Java 编写了所有内容,也使用了 Sun 的库。

我还看到几个用纯 Java 编写的应用程序,在同一版本的 JRE 中的一两个平台上运行良好,但在其他版本的平台上运行失败(我现在使用的产品在 Windows 上运行良好,在 Mac OS X 上运行良好,在 Linux 上不错,但在 Solaris 上失败 - 都使用相同的 JRE)。

移动版本并不是一个简单的步骤,除非应用程序非常小。

When I moved from 1.4.2 to 1.5 on a small applet I worked on, lots of things broke: screen refresh got all wonky, elements moved, etc.

Sun's JRE doesn't maintain backward compatibility for everything. Sometimes when items are deprecated, they completely go away after a very short period of time.

We wrote everything with "stock" Java, using Sun's libraries, too.

I've also seen several application written in pure Java that work fine on one or two platforms in the same version of the JRE fail on others with that version (the product I work with now works great on Windows, ok on Mac OS X, decent on Linux, but fails on Solaris - all with the same JRE).

Moving versions is not a simple step, unless the application is really small.

梦明 2024-07-16 01:25:10

我的经验是兼容性相当高。 我只发现一个应用程序无法在当前版本上运行。 无论出于何种原因(没有源代码,所以我没有深入研究),一个应用程序无法在 1.4.2 以外的任何版本上运行。 我处理过的其他所有内容(其中一些相当大)都达到了 1.6 就好了。 无需修改。

当然,YMMV,所以你必须尝试一下才能看到......

My experience is that the compatibility is quite high. I've only found one app ever that I couldn't get to run on a current version. For whatever reason (not having source, so I didn't dig into it) that one app wouldn't run on anything other than 1.4.2. Everything else I've ever dealt with (some of them quite sizeable) have come up to 1.6 just fine. No modifications required.

YMMV of course, so you'll have to try it and see...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文