Results 1 to 5 of 5
  1. #1
    johnmhic is offline Member
    Join Date
    Aug 2014
    Posts
    2
    Rep Power
    0

    Default JOptionPane cannot be resolved

    I Can't run this simple program
    can u please check for me
    thank you!

    import java.util.Scanner;
    import javax.swing.JOptionpane;
    public class Project {

    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    String st1;
    System.out.print("Enter Name: ");
    st1=input.next();
    JOptionPane.showMessageDialog(null,"Name: "+st1);

    }

    }




    This is the Error that i get in console!

    "Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    JOptionPane cannot be resolved

    at Project.main(Project.java:10)"

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    843
    Rep Power
    6

    Default Re: JOptionPane cannot be resolved

    ur import is wrong change to import javax.swing.JOptionPane
    Ramya:cool:

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: JOptionPane cannot be resolved

    Are you using Eclipse? If so, hit the key combination CTRL + SHIFT + O to fix all import statements automatically.

    When that doesn't help, you have a typo in a class name.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    johnmhic is offline Member
    Join Date
    Aug 2014
    Posts
    2
    Rep Power
    0

    Default Re: JOptionPane cannot be resolved

    Thank You so much, I Appreciate it :-)

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,365
    Rep Power
    6

    Default Re: JOptionPane cannot be resolved

    Does that mean you got it working?

    Edit: yes of course you did, this was a really simple problem. I'm being stupid and thought this was a response to a different thread.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. getClass cannot be resolved
    By Cyrus in forum New To Java
    Replies: 3
    Last Post: 06-03-2014, 07:31 AM
  2. JPanel cannot be resolved?
    By JamieEdwards in forum New To Java
    Replies: 12
    Last Post: 10-26-2013, 08:43 PM
  3. canvasObject cannot be resolved.
    By falconfetus8 in forum New To Java
    Replies: 10
    Last Post: 12-31-2011, 12:42 AM
  4. Array cannot be resolved
    By aqeel2010 in forum New To Java
    Replies: 4
    Last Post: 10-07-2011, 07:38 PM
  5. HttpServletRequest cannot be resolved-- Help me
    By hphuoc in forum Java Servlet
    Replies: 1
    Last Post: 04-26-2011, 10:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •