Development Environment jdk1.5, deployment environment jdk1.4 bigdecimal Problems

Source: Internet
Author: User

The development environment is jdk1.5, the deployment environment is jdk1.4, compiled with antProgram-Source 1.4 has been specified at the time, no problem in the past, a problem has occurred recently. Google, it was found that bigdecimal was used,

From: 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 using Ge (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 cocould be used too.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.