开发者

why won't Eclipse use the compiler I specify for my project?

开发者 https://www.devze.com 2022-12-25 11:36 出处:网络
I\'m using Eclipse 3.3.In my project, I\'ve set the compiler compliance level to 5.0 In the build path for the project. I\'ve added the Java 1.5 JDK in the Installed JREs section and am referencing th

I'm using Eclipse 3.3. In my project, I've set the compiler compliance level to 5.0 In the build path for the project. I've added the Java 1.5 JDK in the Installed JREs section and am referencing that System Library in my project build path. However, I'm getting compile errors for a class that implements PreparedStatement for not implementing abstract methods that only exist in Java 1.6 PreparedStatement. Specifically, th开发者_如何学运维e methods

setAsciiStream(int, InputStream, long) and 
setAsciiStream(int, InputStream)

Strangely enough, it worked when we were compiling it against Java 1.4, which it was originally written for. We added the JREs for Java 1.4 and referenced that system library in the project, and set the project's compiler level to 1.4, and it works fine. But when I do the same changes to try to point to Java 5.0, it instead uses Java 6.

Any ideas why?

I wrote a similar question earlier, here:

how do I get eclipse to use a different compiler version for Java?

I know how you're supposed to choose a different compiler but it seems Eclipse isn't taking it. It seems to be defaulting to Java 6, even though I have deleted all Java 6 JDKs and JREs that I could find. I've also updated the -vm option in my eclipse.ini to point to the Java5 JDK.


This isn't about the compiler - it's only about the library! Go to the project's properties, then under Java Build Path / Libraries, remove the JRE System library. Then use Add Library... to add the version of the JRE library you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号