且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JDK 1.6与JDK 1.5兼容吗?

更新时间:2022-10-14 23:09:07

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

  javac -target 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

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.

You can download JDK 1.5 from the Sun Archive.