Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"The import java.awt cannot be resolved" and " ***** cannot be resolved to a type"

Tags:

java

eclipse

I downloaded a Java project that I want to study and learn some things from. When I downloaded it on another computer it worked great, but when I try it on my computer, nearly every declaration and import is given the error message "* cannot be resolved to a type" or "The import java.awt cannot be resolved".

I did some research on this site and found that it might have to do with not having the latest Java installed. I checked mine, and I have JavaSE-1.7 (unbound). So I have the latest version but it's (unbound)?

Can this be the problem? And what does (unbound) mean?

I'm using Eclipse 3.3.2

UPDATE: I just found this error message at the top of the Properties window: org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7. What does this mean?

like image 496
CodyBugstein Avatar asked Dec 04 '12 14:12

CodyBugstein


2 Answers

This occurs because project has dependency on library of J2SE 1.7 but it cannot find JRE at that location in your machine.

Project->Properties->Java Build Path

Or Add a new JRE in eclipse using Window>Preferences>Java>Installed JRE and locate the path of the JRE folder in your machine. and then replace the dependency of your project with the new JRE you installed in eclipse.

UPDATE UNBOUND JRE in Hello World

like image 149
Narendra Pathai Avatar answered Sep 17 '22 09:09

Narendra Pathai


This may work for some... it did for me:

  1. Hover over "java.awt" in your code, and under quick fixes available, select Fix Project Setup.

  2. Pop-up displays saying "The following proposals have been found..." and
    "Add Library JRE System Library[JavaSE-1.7] to build path" is selected.

  3. Select Ok.

like image 39
wizurd Avatar answered Sep 19 '22 09:09

wizurd