JDK 1.6 compatible with JDK 1.5?

微笑、不失礼 提交于 2019-11-29 14:43:39

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/3050219/jdk-1-6-compatible-with-jdk-1-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!