JDK 1.6 与 JDK 1.5 兼容吗?

发布于 2024-09-06 06:56:14 字数 96 浏览 0 评论 0 原文

我遇到了兼容问题,我的项目是在 JDK 1.6 中开发的,但是当我需要将其发布到主机域时,存在主机域使用 JDK 1.5 的问题,如何使我的项目与 JDK 1.5 兼容?提前致谢

Im having a compatible issue, my project is develop in JDK 1.6, but when i need to post it to a host domain, there is a issue where the host domain used JDK 1.5, how do i make my project compatible with JDK 1.5? thanks in advance

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

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

发布评论

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

评论(2

谷夏 2024-09-13 06:56:14

您基本上需要设置 -target 属性。另请参阅javac /?

javac -target 1.5 [...]

另请参阅此示例在 javac 的文档中。


更新:根据您使用 Eclipse 的评论,您只需更改每个项目的编译器合规性级别即可。 右键单击项目>属性> Java编译器>编译器合规级别> 1.5查看屏幕截图

alt text

您可以从 Sun Archive

You basically need to set the -target attribute. Also see javac /?.

javac -target 1.5 [...]

Also see this example in javac's documentation.


Update: as per the comments you're using Eclipse, you can just change the compiler compliance level on a per-project basis. Rightclick project > Properties > Java Compiler > Compiler compliance level > 1.5. See screenshot.

alt text

You can download JDK 1.5 from the Sun Archive.

榕城若虚 2024-09-13 06:56:14

您应该能够将编译器/IDE 上的合规性级别设置为 1.5,以便标记任何不兼容性(通过编译器警告)。然后,您可以修复任何需要做的事情以使您的代码兼容 1.5。

例如,在 Eclipse 中,您可以转到 Preferences / Java / Compiler 并将合规性级别设置为 1.5。其他 IDE 中可能也有类似的情况。

You should be able to set the compliance level on your compiler / IDE to 1.5 so that any incompatibilities are flagged (via compiler warnings). You can then fix whatever needs to be done to make your code 1.5 compatible.

In Eclipse for example, you go to Preferences / Java / Compiler and set the compliance level to 1.5. It's probably something similar in other IDEs.

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