当前位置: 动力学知识库 > 问答 > 编程问答 >

upgrade - Upgrading from Java 1.4 to JAVA 6 SE

问题描述:

I am currently upgrading from JAVA 1.4 to JAVA 6 SE. Some of the methods and classes have either been deprecated or there are a lot of warnings due to inefficient practices. I want to know if it is possible for me to upgrade without making any changes to my code and after the changes remote debug to fix the errors. If there's a simpler or more efficient way of doing this please share.

网友答案:

I want to know if it is possible for me to upgrade without making any changes to my code and after the changes remote debug to fix the errors.

We can't give you a definitive yes or no to that.

First, it should be noted that most of the deprecations and warnings can be ignored to start with. (Some are telling you about things that should be fixed soon, but the most egregious examples of bad / dangerous APIs were deprecated long before Java 1.4)

So one reason we can't give you a definitive answer is that we don't know what warnings you are seeing (duh!).

The other reason is that we don't know how good / extensive your test suite is. If you have a good test suite, the chances are good that any problems will be picked up. If not, or if you are relying on manual testing, then your chances of finding any problems cause by the upgrade are greatly reduced.


The other thing to note is that the documentation for each major Java release includes a section on Incompatibilities between the new release and the previous one. It is a good idea to at least skim these documents to see if any of the issues highlighted are likely to impact on your application.


Finally, most people find that upgrading doesn't result in a large swath of problems. There are exceptions of course. And if you are in the habit of depending on implementation specific behaviour rather than what the javadocs say, THAT can lead to pain.

网友答案:

The usual approach is:

  • Run your code through the new compiler
  • Fix any compile errors (might happpen in some rare cases, like when you used the word enum as identifier, which is a keyword for Java 1.5 and greater)
  • Do a full QA cycle to verify that your application still works properly

Besides that, you should consider upgrading to Java 7 - Java 6 is also already in its end-of-life phase.

网友答案:

Basically, you can run your Java 1.4 code on a Java 6 virtual machine without modifications. New API's might have been introduced, effectively deprecating old ones. Usually, the Javadoc of the deprecated API should give you a pointer what you should use instead.

分享给朋友:
您可能感兴趣的文章:
随机阅读: