Margus
Margus

Reputation: 20068

Upgrade Eclipse java compiler

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\BufferedInputStream.class(java\io:BufferedInputStream.class): major version 51 is newer than 50, the highest major version supported by this compiler.
[javac] It is recommended that the compiler be upgraded.

How do I upgrade compiler?

Upvotes: 10

Views: 33080

Answers (7)

Jason
Jason

Reputation: 3

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.

Upvotes: 0

Alex
Alex

Reputation: 7521

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

Upvotes: 1

Andreas L.
Andreas L.

Reputation: 2933

I solved my warning with answer from Bao. I had JDK1.6 installed before. Then installed JDK1.7 and ant was stil using JKD1.6 for compiling.

What I have changed is also set the JDK for the project: right click on project > properties > Java Build Path

If you have JDK1.6 here, try to change it to JDK1.7.

Upvotes: 0

Dario
Dario

Reputation: 21

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.

Upvotes: 2

Bao
Bao

Reputation: 91

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

Upvotes: 9

Michael Borgwardt
Michael Borgwardt

Reputation: 346476

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.

Upvotes: 11

Jigar Joshi
Jigar Joshi

Reputation: 240946

download and install newer version of JDK.

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

Upvotes: 11

Related Questions