ZamPrano
ZamPrano

Reputation: 63

Eclipse: false error with jdk7

I've been having a problem with eclipse that's been stressing me a lot. Whenever I start a new Java porject, everything goes smoothly and perfect, until I "clean" the project (Project -> Clean...) and everything goes to @#~%&...
I keep getting:

That's very nice, only that I am importing all required classes and I do have 1.7 since the begginig. It's the only version I've installed. I've already tried this and other similar responses for the last few days with no avail.
A solution was to create a new project, copy and paste all packages/clases, which worked for a while, but I added UMLet to the project and again... Removing UMLet plugin did nothing for me.

BTW, even with the "errors", my project runs without any problem, therefore I know they're not real. I could keep working, but then, I can't see when a real error arises... Does anyone got a final solution to get rid of this false errors?

EDIT: I forgot to mention that I'm working with Kepler.

EDIT 2:

Here are screen captures with the requested information.

Java Build Path

Java Compiler

Upvotes: 3

Views: 12421

Answers (3)

user7095118
user7095118

Reputation: 1

Multi-catch parameters are not allowed for source level below 1.7

not a solution, to this issue, but if you want to have two exceptions you can code it like this:

try {
    // code here
} catch {
    // code here
} catch {
    // code here
}

it worked for me, instead of having catch (exception1 | exception2 e)

Upvotes: 0

Yogesh Varal
Yogesh Varal

Reputation: 131

You can solve this by setting up correct JRE environment in Eclipse as below.

  1. Go to Project => Properties => Java Build Path
  2. Click on Libraries
  3. Select JRE System Library
  4. Click on Edit button at right hand side
  5. Set Execution Environment to Jave SE-1.7(jre7)
  6. Clean project or refresh project.

Upvotes: 5

Stephen C
Stephen C

Reputation: 719307

A solution was to create a new project, copy and paste all packages/clases, which worked for a while, but I added UMLet to the project and again...

One possibility is that the UMLet plugin is the cause of your problems. Try a clean Eclipse install without UMLet. (The fact that uninstalling the UMLet plugin didn't fix the problem is in no way conclusive.)

Note that UMLet will run as a stand-alone tool.

BTW, even with the "errors", my project runs without any problem, therefore I know they're not real.

The likely explanation for that is that the compilation errors come from the incremental Java compiler that is built into Eclipse. A different compiler (i.e. the one from your installed / configured JDK) is used to generate the ".class" files.

Upvotes: 2

Related Questions