FULL PRODUCT VERSION :
Both :
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
And
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux dub-280-41 2.6.10-gentoo-r4 #1 SMP Mon Jan 10 12:03:01 GMT 2005 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux
A DESCRIPTION OF THE PROBLEM :
I was looking into migrating from JDK1.4 to JDK1.5, and given the code (in the example code section)
when I compile this on JDK1.4, it compiles and runs correctly
However, when I compile it as:
/opt/sun-jdk-1.5.0.01/bin/javac -source 1.4 Test.java
And run it (using the 1.4 JVM), I get the following error at runtime:
Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the example source using JDK1.4, run -- works correctly
Compile the example source using JDK1.5, and run against the 1.5 JVM -- works correctly
Compile the example source using JDK1.5, and run against the 1.4 JVM -- fails with NoSuchMethodError
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should work on all releases.
ACTUAL -
NoSuchMethodError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
at Test.main(Test.java:6)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.math.BigDecimal;
public class Test
{
public static void main(String[] args)
{
BigDecimal dec = new BigDecimal(1);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Change the code to
BigDecimal dec = new BigDecimal((double) 1);
###@###.### 2005-2-08 21:09:42 GMT
Both :
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
And
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux dub-280-41 2.6.10-gentoo-r4 #1 SMP Mon Jan 10 12:03:01 GMT 2005 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux
A DESCRIPTION OF THE PROBLEM :
I was looking into migrating from JDK1.4 to JDK1.5, and given the code (in the example code section)
when I compile this on JDK1.4, it compiles and runs correctly
However, when I compile it as:
/opt/sun-jdk-1.5.0.01/bin/javac -source 1.4 Test.java
And run it (using the 1.4 JVM), I get the following error at runtime:
Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the example source using JDK1.4, run -- works correctly
Compile the example source using JDK1.5, and run against the 1.5 JVM -- works correctly
Compile the example source using JDK1.5, and run against the 1.4 JVM -- fails with NoSuchMethodError
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should work on all releases.
ACTUAL -
NoSuchMethodError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
at Test.main(Test.java:6)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.math.BigDecimal;
public class Test
{
public static void main(String[] args)
{
BigDecimal dec = new BigDecimal(1);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Change the code to
BigDecimal dec = new BigDecimal((double) 1);
###@###.### 2005-2-08 21:09:42 GMT
- relates to
-
JDK-6578661 StringBuffer.insert() compiles with CharSequence with 1.4 target
-
- Closed
-
-
JDK-6983077 given "-source 1.3" javac does not complain on Boolean.toString(boolean) as 1.4+
-
- Closed
-
-
JDK-6900037 javac should warn if earlier -source is used and bootclasspath not set
-
- Closed
-