MickG
MickG

Reputation: 3276

Eclipse source level problems

Eclipse tells me:

for each statements are available only if source level is 1.5 or greater

what does that mean and how do I solve this? I'm trying to import a program I built with NetBeams which has a GUI. Should I post the full code as well?

Upvotes: 3

Views: 1418

Answers (2)

Java42
Java42

Reputation: 7706

Open the Preferences panel and set source level or maybe check Use default compliance settings.

enter image description here

Upvotes: 4

nanofarad
nanofarad

Reputation: 41281

Eclipse's source level is a feature allowing code to be written for older versions of Java, using a limited feature-set. For some reason or another, your project got imported, and the source level was set too low. You need to set it higher.

Go to project properties by right-clicking the project in the explorer at left, and select the "java compiler" pane at the left of the settings window.

Set the compliance level and source compatibility to 1.5 or higher (highest is usually OK, though you may want to stay no higher than 1.7 for now)

On the "Java Build Path" pane,"Libraries " tab, make sure that the JRE system library is at least as high as the source compatibility and source levels you set.

Upvotes: 1

Related Questions