是否可以使用JDK 1.6构建java代码以在JRE 1.5上运行? [英] Is is possible to build java code using JDK 1.6 to run on JRE 1.5?

查看:89
本文介绍了是否可以使用JDK 1.6构建java代码以在JRE 1.5上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JDK 1.6编译时,是否可以选择构建在JRE 1.5上运行的Java代码?

Is there an option to build java code to run on JRE 1.5 when compiled using JDK 1.6?

PS:我是Java的新手。

PS: I am new to Java.

推荐答案

如果用1.6编译代码,那么它将无法在1.5上运行。如果你希望它在1.5中运行,那么你可以用1.5编译代码,它可以在两者上运行。

If you compile your code with 1.6 then it will not run on 1.5. If you want it to run in 1.5 then you can compile the code with 1.5 and it would be able to run on both.

尝试用1.5编译并且如果有错误然后张贴他们。如果你在代码中使用特定的1.6增强功能,它在1.5上编译的唯一方法是。

Try compiling with 1.5 and if there are errors then post them. The only way it will not compile on 1.5 is if you use specific 1.6 enhancements in your code.

回答真实问题。

  javac -target 1.5

请参见此处了解更多详情。

这篇关于是否可以使用JDK 1.6构建java代码以在JRE 1.5上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆