Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import XXX cannot be resolved for Java SE standard classes [duplicate]

Tags:

java

eclipse

I use Eclipse and turns out I have a bunch of import * not resolved errors.

import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; 

All of the above have the same error. I checked my java version it is 1.7.0 open jdk. I updated Java Home and the JRE library to use. Its still not working. Note: I imported the code repository from bibucket via the mercurial plugin itself.

like image 275
Karthik Avatar asked Jun 04 '13 13:06

Karthik


People also ask

How do I resolve an error in eclipse?

The Quick Fix dialog can also be displayed by right clicking on the error item in the Problems view and selecting the Quick Fix menu item.

Can not be resolved to a type java?

This means that your project isn't setup to include the JUnit libraries when it compiles; JUnit is not included in the Java runtime libraries (JRE System Library) so you have to add it to the build path.


2 Answers

Right click on project - >BuildPath - >Configure BuildPath - >Libraries tab - >

Double click on JRE SYSTEM LIBRARY - >Then select alternate JRE

like image 123
PSR Avatar answered Oct 06 '22 00:10

PSR


If the project is Maven, you can try this way :

  1. right click the "Maven Dependencies"-->"Build Path"-->"Remove from the build path";
  2. right click the project ,navigate to "Maven"--->"Update project....";

Then the import issue should be solved .

like image 23
Alter Hu Avatar answered Oct 05 '22 23:10

Alter Hu