当 Java1.6 取代了 Java 1.5 时,我们为什么要更新在 Java 1.5 上运行的应用程序?我们该怎么做?
3 回答
最终,Java 5 将走到生命的尽头。这将是开始在 Java 6 上运行它的一个很好的理由。
我想,瞄准拥有最多受众的平台也是明智之举。
许多应用程序在两个平台上都运行良好。如果您的应用程序依赖于 Java 5 中已停用的功能,我会考虑重写它以支持未来的 Java 平台。
怎么做?你确定你需要做任何事情吗?除非它使用已停产的 api,否则一个简单的重新编译最多可以做到。还要注意有关使用已弃用 api 的任何警告。它们可能会在 Java 的未来版本中消失。
You should ask anyone who is telling you to use Java 5.0. If that is the only supported Java version for your application, you may have to use it.
You should probably take Java 6 (this is likely to be the best choice).
Java 7 is likely to be released this year and if you have an application which won't be released for some time, you could develop it using Java 7 from the start.
However if the application works and you don't need to change it why not just leave it as is.
It depends on your situation and your requirements as to what is the best version to use.
让目标机器上的运行时保持最新是一个好主意。除其他事项外,运行旧版本还存在安全隐患。这可能根本不需要您触摸您的代码。可能是您使用了已被删除的 API,或者您依赖的行为被认为是错误/安全漏洞,但我认为这些情况相对较少。
至于你是否更新你的开发环境以使用最新的 JDK,这取决于你是否要使用最新的功能等。请记住,旧的 JVM 可能无法运行针对更新版本编译的代码爪哇。