Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java import error in eclipse

Tags:

I have a code written in java. when i load it in eclipse it shows an error in the java code import line " The import com.sun.java.browser.plugin2 cannot be resolved"

import com.sun.java.browser.plugin2.*;

How can i fix this error..??

like image 269
Andromeda Avatar asked Jan 29 '10 08:01

Andromeda


People also ask

How do I fix the error the Import Cannot be resolved?

Whenever you come across this problem just go to Project > Clean, then select Clean all projects. It should get resolved, otherwise try to delete those jars and add them again.


1 Answers

It's possible that it's to do with the version of Java you're building your project with, since the new applet class files were only introduced in Java 1.6 / 6.0. So, right click on your project on the left, go to Properties, Java Build Path, Libraries tab, and scroll down the list until you see JRE System Library. Note the version. If it reads less than 6.0 / 1.6, you're using an old version.

Click on JRE System Library, click Remove (make sure you have at least Java 1.6 installed!) then click Add Library. Select JRE System Library and select your Java version. If this isn't listed, go to Window > Preferences, Java > Installed JREs, click Add, and locate your JRE. Then repeat the same process and it should work.

(Edit: ignore what I said, the com.sun.* classes are hidden from the user. I don't think you can use it)

like image 74
Chris Dennett Avatar answered Dec 07 '22 17:12

Chris Dennett