Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDK 1.5 -target=1.4 and -source=1.4 problem

843810Aug 5 2008 — edited Apr 9 2009
I am using the maven-compiler-plugin to mange the build of my project.
The configuration for this plugin is as follows;

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>

This plugin passes the target and source arguments through to the compiler.
I have compiled and packaged this project successfully using a 1.5 JDK presuming that by setting the target and source options to 1.4 that it will run on VMs in JDK 1.4 and later, but will not run on 1.1, 1.2 or 1.3 VMs - as stated in the supporting documentation here - [http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#options|http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/javac.html#options]

I then successfully deployed this project to wehsphere 5.1 which is using IBM's 1.4 JDK, but when I submitted a request to the service I encountered the following error;

java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V

This is because the BigDecimal constructor is different in JDK 1.4 and JDK 1.5 - so why am I encountering this error when I have used the recomended options (of target and source) to ensure that the source code runs on a 1.4 JDK ???

Thanks in advance for your help
David
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 7 2009
Added on Aug 5 2008
4 comments
749 views