How to have Eclipse use JDK8 to compile a project?

前端 未结 1 605
你的背包
你的背包 2021-02-11 14:52

I\'m experimenting with the new jdk8 what is available here http://jdk8.java.net/lambda/

I\'m able to compile and run my project from command line.

I\'m also abl

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-11 15:29

    Eclipse uses a built-in compiler rather than javac. The built-in compiler obviously doesn't support Java 8 yet.

    You can define a custom builder for your project which will call your javac. In the project's preferences, go to "Builders", add a new custom builder (which can be either an Ant script or an executable program) and disable the default built-in Java builder.

    Afterwards, running the project with the JDK of your choice shouldn't be a problem - adding it to the "Installed JREs" preference page (as you did) should be sufficient.

    0 讨论(0)
提交回复
热议问题