JDK version setting not honored
From the mailing list:
have to make sure my code runs on Java 5, therefore I'm developing
with Java 5 on the classpath of my project. I've installed Java 5 on
Snow Leopard following these instructions:
http://wiki.oneswarm.org/index.php/OS%5FX%5F10.6%5FSnow%5FLeopard
This makes sure I have a real Java 5 SDK and not just a symlink that
points to the Java 6 SDK. The point being, of course, that the
compiler should make sure I'm not using any Java 6 API in my code.
But when I try this, which should fail because the String constructor
that takes a byte array and a Charset is new in Java 6, it does
compile:
and fails at runtime with a java.lang.NoSuchMethodError:
java.lang.String.<init>([BLjava/nio/charset/Charset;)V
A Java file in the same project (hence same classpath) correctly
refuses to build the corresponding Java code with error "The
constructor String(byte[], Charset) is undefined".
have to make sure my code runs on Java 5, therefore I'm developing
with Java 5 on the classpath of my project. I've installed Java 5 on
Snow Leopard following these instructions:
http://wiki.oneswarm.org/index.php/OS%5FX%5F10.6%5FSnow%5FLeopard
This makes sure I have a real Java 5 SDK and not just a symlink that
points to the Java 6 SDK. The point being, of course, that the
compiler should make sure I'm not using any Java 6 API in my code.
But when I try this, which should fail because the String constructor
that takes a byte array and a Charset is new in Java 6, it does
compile:
object Test {
def main(args: Array[String]) {
val b = Array[Byte](34, 35, 36)
val s = new String(b, Charset.forName("UTF-8"))
}
}
and fails at runtime with a java.lang.NoSuchMethodError:
java.lang.String.<init>([BLjava/nio/charset/Charset;)V
A Java file in the same project (hence same classpath) correctly
refuses to build the corresponding Java code with error "The
constructor String(byte[], Charset) is undefined".
Leave a comment
on 2011-05-09 07:03 *
By Iulian Dragos
Can you check if you have the 1.6 JRE on your project classpath?
on 2011-05-09 07:46 *
By David Bernard
- copy form email -
I think, there is the issue with every version of ScalaIDE. because Scala builder and presentation compiler used the JDK/JRE used to run eclipse to compile and not the jdk define in the jdt configuration.
I think, there is the issue with every version of ScalaIDE. because Scala builder and presentation compiler used the JDK/JRE used to run eclipse to compile and not the jdk define in the jdt configuration.
on 2011-08-15 06:48 *
By Iulian Dragos
Hubert, can you please have a look at this one? Should it work with the new SBT builder?
It should, but is not. investigating.
(In revision:18a034b0f3f1fb03af58fb5c449d15ccfc7af3e3) Fixes #1000406. Also don't add compiler to the classpath automatically
Branch: release/scala-ide-2.0.x
Branch: release/scala-ide-2.0.x
on 2011-10-24 10:28 *
By Hubert Plociniczak
(In revision:18a034b0f3f1fb03af58fb5c449d15ccfc7af3e3) Fixes #1000406. Also don't add compiler to the classpath automatically
Branch: master
Branch: master
(In revision:62fe8e2fed1b2b92417a4ee4ee7acee4d54f59e3) I had to revert this as it looks like it is no longer possible to add the compiler in the project's classpath (which makes it difficult to do any development in the IDE). I'm reopening this ticket.
I reverted the change in both release/scala-ide-2.0.x and master branches.
I reverted the change in both release/scala-ide-2.0.x and master branches.
on 2011-10-28 09:22 *
By Hubert Plociniczak
Ok, found the problem in EclipseSbtBuildManager. I will fix it over the weekend.
(In revision:18a034b0f3f1fb03af58fb5c449d15ccfc7af3e3) Fixes #1000406. Also don't add compiler to the classpath automatically
Branch: issue/implicit-highlighting-1000628
Branch: issue/implicit-highlighting-1000628
It shouldn't be fixed since the commit was reverted.
(In revision:b3a196aaeddf9cf800463ad11242c9cf74208aad) Merge pull request #40 from scala-ide/issue/jdk-1000406-again
Closes #1000406. One sbt test still ignored but not related to this bug.
Branch: master
Closes #1000406. One sbt test still ignored but not related to this bug.
Branch: master
on 2011-11-13 04:43 *
By Hubert Plociniczak
(In revision:b3a196aaeddf9cf800463ad11242c9cf74208aad) Merge pull request #40 from scala-ide/issue/jdk-1000406-again
Closes #1000406. One sbt test still ignored but not related to this bug.
Branch: platform/indigo-3.7
Closes #1000406. One sbt test still ignored but not related to this bug.
Branch: platform/indigo-3.7