Upgrade Eclipse java compiler

后端 未结 7 1216
南笙
南笙 2021-02-20 17:32

I started using Ant, that ships with Eclipse. It annoys me, that I get hundreds of warnings in the lines of:

[javac] warning: java\\io\\BufferedInputStr

相关标签:
7条回答
  • 2021-02-20 17:56

    Since my development environment should be based on Java 6 the only thing that helped for this problem was removing Java 7 at all

    0 讨论(0)
  • 2021-02-20 17:59

    download and install newer version of JDK.

    Windows - > Preference - > Java - > Installed JRE set newer version here

    0 讨论(0)
  • 2021-02-20 17:59

    Major version 51 is Java 7 - looks like you're developing against a preview Java 7 API library but compiling with a Java 6 javac. Either make sure ant uses the Java 7 compiler, or use a Java 6 API library to compile against.

    0 讨论(0)
  • 2021-02-20 17:59

    One additional thing you probably also need to do is to go under the JRE tab of the Edit Configuration window and select the JRE version.

    0 讨论(0)
  • 2021-02-20 18:00

    Thanks, I figured it out.

    For those whom it may concern, to make sure Ant uses the Java 7 compiler:

    Preferences -> Ant -> Runtime -> Classpath -> Global Entries
    

    Click Add External Jars and put your tools.jar here.

    It will look something like C:\Program Files\Java\jdk1.7.0_03\lib

    0 讨论(0)
  • 2021-02-20 18:11

    Follow these steps:

    1. Download last JDK and install it.
    2. Go to C:/Program files/Java and delete the previous JDK.
    3. Update your JAVA_HOME and PATH Environment Variables with the new JDK.
    4. Open Eclipse and in Windows > Preference > Java > Installed JRE, set newer version here

    If there is a broken link with a jar in previous JDK, Eclipse will notify you. I solved in this way the problem with tools.jar ant reference, but it is a general way to find the solution.

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