Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Eclipse java compiler

Tags:

java

eclipse

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?

like image 944
Margus Avatar asked Nov 24 '10 14:11

Margus


People also ask

How do I change the compiler version in Eclipse?

To configure compiler compliance level and settings in eclipse, find the below steps. Step 2: Go to Java -> Compiler . Find the print screen. Step 4: To change default compliance settings, we need to uncheck Use default compliance settings and set the compiler java version for .

How do I update Java 11 in Eclipse?

It can be added from the Window > Preferences > Java > Installed JREs > Add... page. It can also be added from the Package Explorer using the project's context menu. An option to set compiler compliance to 11 on a Java project is also provided.

Which version of Eclipse is best for Java 11?

Eclipse 4.23 (2022-03) It is the supported release. A Java 11 or newer JRE/JDK is required, LTS release are preferred to run all Eclipse 2022-03 packages based on Eclipse 4.23, with certain packages choosing to provide one by default. The Installer now also includes a JRE--consider using the Installer.


3 Answers

download and install newer version of JDK.

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

like image 192
jmj Avatar answered Sep 28 '22 04:09

jmj


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.

like image 45
Michael Borgwardt Avatar answered Sep 28 '22 02:09

Michael Borgwardt


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

like image 35
Bao Avatar answered Sep 28 '22 04:09

Bao