I have my project which was compiled and built using jdk1.4
. Now I want to compile the same with jdk1.8
.
However, build fails saying that StringBuilder
is not found in java.lang
package which is strange for me.
In my build.xml
file, I have set source=1.4 & target = 1.8. Am I doing anything wrong?
StringBuilder
was introduced in jdk1.5 and our legacy project is getting compiled with 1.4. There are lines of code similar to the below sample.
throw new IllegalArgumentException("usage of String Builder ("+data.length+")");
I have 2 doubts here:
- How is the code getting built with jdk1.4? In the build.xml,I specified source and target versions to 1.4 and it builds fine.
- Why is not getting build for any versions(source and target) higher than 1.4?