开发环境jdk1.5,部署环境jdk1.4 BigDecimal出现问题
2006-07-05 11:32
519 查看
开发环境是jdk1.5,部署环境是jdk1.4,用ANT编译程序的时候已经指定了-source 1.4,以前都没问题,最近出问题了。GOOGLE了一下,发现是因为使用了BigDecimal,
以下摘自:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6226858
As part of jsr 13, a new constructor, BigDecimal(int val), was added to BigDecimal in JDK 5. Therefore, in 1.4 and earlier
new BigDecimal(1)
in the source resolves to BigDecimal(double) while in 1.5 it resolves to BigDecimal(int), which is not present in earlier JDKs. The -source flag of javac only restricts the constructs in the source languge (e.g. assert, generics); it does *not* restrict or filter the contents of the libraries. Therefore, in JDK5 if you compile with "javac -source 1.4" you will still be compiling against the 1.5 version of the libraries. Therefore, in cases like the one in this bug, code compiled at a lower language level might not be able to be used with an ealier release supporting that language level.
To match both the language and libraries of an ealier jdk, use -source and the -bootclasspath flag to specify the earlier rt.jar as well. Of course the ealier jdk could be used too.
以下摘自:http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6226858
As part of jsr 13, a new constructor, BigDecimal(int val), was added to BigDecimal in JDK 5. Therefore, in 1.4 and earlier
new BigDecimal(1)
in the source resolves to BigDecimal(double) while in 1.5 it resolves to BigDecimal(int), which is not present in earlier JDKs. The -source flag of javac only restricts the constructs in the source languge (e.g. assert, generics); it does *not* restrict or filter the contents of the libraries. Therefore, in JDK5 if you compile with "javac -source 1.4" you will still be compiling against the 1.5 version of the libraries. Therefore, in cases like the one in this bug, code compiled at a lower language level might not be able to be used with an ealier release supporting that language level.
To match both the language and libraries of an ealier jdk, use -source and the -bootclasspath flag to specify the earlier rt.jar as well. Of course the ealier jdk could be used too.
相关文章推荐
- 使用OSS JavaScript的sdk进行web端直传,开发环境下测试没有问题,但部署到服务器上或者打包到IOS原生包中出现了问题。
- android 开发环境安装和测试中常出现的问题
- 解决jsp验证码在以下环境不能显示的问题(jdk1.4+tomcat5.0+linux)
- Mac系统WIFI环境下用idea开发java出现IPv6地址问题
- JDK 1.7+Android SDK+IntelliJ IDEA 13+Genymotion 安卓开发环境部署
- JDK环境变量配置以及可能出现的问题
- android搭建开发环境 ---- gradle wrapper出现问题
- android开发环境安装(Eclipse)出现的几个问题
- Android开发之 adb 启动问题或是部署应用不成功,出现“The connection to adb is down, and a severe error has occured.”错误
- windows安装java开发环境后出现javac无法使用的问题
- 安装集成PHP开发环境出现“计算机中丢失 MSVCR110.dll”问题
- erlang集成开发环境搭配配置出现的问题
- android 开发环境安装和测试中常出现的问题
- 使用spring和jdk1.7开发web项目时出现的注解定义pointcut的问题
- [原]阿里云服务器 操作实战 部署C语言开发环境(vim配置,gcc) 部署J2EE网站(jdk,tomcat)
- php开发和调试环境的配置+出现 57% waiting for xdebug session的问题
- maven(多个模块)项目 部署 开发环境 问题处理历程【异常Name jdbc is not bound in this Context 异常java.lang.NoSuchMethodE】
- IOS开发基本教程1 环境搭建中间有可能出现的问题
- maven部署出现 not found: G:\jdk\..\lib\tools.jar -> [Help 1] 等问题