Tom
Tom

Reputation: 393

Java unable to import normal libraries in eclipse

This question may be too easy for you guys, but I'm really new to java and have no idea how to solve it. I added some external libraries to my project in eclipse, which work well, but some of my normal imports show errors, and has red line under import. like:

import java.awt.Dimension;
import java.io.File;
import java.io.IOException;

How should I solve this? Thank you in advance.

Upvotes: 0

Views: 940

Answers (2)

SparkOn
SparkOn

Reputation: 8946

First go to windows ->preferences ->Java -> Installed JREs and check if the JDK is checked not just a JRE.

Also Right click on the project -> Properties -> Java Build Path ->libraries tab and check whether the JRE System Library is present and if not.

Add it using Add library -> JRE System Library and then select JRE for the project build path

Upvotes: 0

betteroutthanin
betteroutthanin

Reputation: 7546

You can solve this by adding JRE System Library:

Right click your project -> properties -> Java Build Path -> Libraries -> Add Library -> JRE System Library

Upvotes: 2

Related Questions