0

I'm getting this error:

The type javax.swing.JComponent cannot be resolved. It is indirectly referenced from required .class files

How do I resolve it? Below is my code:

import javax.swing.JOptionPane;

class Hello {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        JOptionPane.showMessageDialog(null,"Hello");
    }

}
Draken
  • 3,134
  • 13
  • 34
  • 54
Ho Man
  • 1
  • 1
  • 3
  • Looks like duplicate http://stackoverflow.com/questions/29901132/jpanel-error-j-component-cannot-be-resolved – maximelian1986 Mar 02 '17 at 14:07
  • but hey i can't solve the problem with the answer given in that topic, feel bad – Ho Man Mar 02 '17 at 14:09
  • 2
    Possible duplicate of [Java project in Eclipse: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files](http://stackoverflow.com/questions/18075343/java-project-in-eclipse-the-type-java-lang-object-cannot-be-resolved-it-is-ind) – Mingebag Mar 02 '17 at 14:23
  • I'm sorry , i've tried everything they told me to do but noting seems work , i can't fix this error @Mingebag – Ho Man Mar 02 '17 at 16:02
  • Which buildsystem (maven, gradle) and which IDE (Eclipse, IntelliJ) do you use? – tkruse Jan 11 '18 at 08:37
  • Go there ,it is **already answered** – Prakash Kaushal May 01 '18 at 13:21

1 Answers1

0

Probably this problem arises from eclipse. When i have this problem i was using Eclipse Helios (Helios is an old version.). Then downloaded Eclipse Oxygen (newest version) and ran project, problem solved. Your problem looks very like much mine. Good Luck.

hardchess
  • 1
  • 1
  • you got `The type javax.swing.JComponent cannot be resolved` error? – Ori Marko Jan 11 '18 at 07:26
  • 2
    Just download new version isn't really an answer – Ori Marko Jan 11 '18 at 07:28
  • This is a real solution guys. This problem is an eclipse bug. [look this document](http://dev-answers.blogspot.com.tr/2009/06/eclipse-build-errors-javalangobject.html) And if the matter is a bug, best way is delete&install, close&open... This is computer. And if i solved this problem with my way. This is a kind of solution. I hope my solution helping people who have got this problem. – hardchess Jan 11 '18 at 18:21