What does "cannot be resolved to a type" mean?

This error message is generated in Eclipse and I don't know what it means. I guess it might have multiple interpretations. Could you please comment this error message ?

junit.framework.AssertionFailedError: Exception in constructor: testCreateCustomer (java.lang.Error: Unresolved compilation problems:
     CustomerMgtSvcImpl cannot be resolved to a type
     m_service cannot be resolved
     CustomerMgtSvcImpl cannot be resolved to a type
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     m_service cannot be resolved
     at com.tel.customermgt.CustomerMgtSvcImplTest.<init>(CustomerMgtSvcImplTest.java:74)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
     at java.lang.reflect.Constructor.newInstance(Unknown Source)
     at junit.framework.TestSuite.createTest(TestSuite.java:131)
     at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
     at junit.framework.TestSuite.<init>(TestSuite.java:75)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:399)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
     at junit.framework.Assert.fail(Assert.java:47)
     at junit.framework.TestSuite$1.runTest(TestSuite.java:263)
     at junit.framework.TestCase.runBare(TestCase.java:127)
     at junit.framework.TestResult$1.protect(TestResult.java:106)
     at junit.framework.TestResult.runProtected(TestResult.java:124)
     at junit.framework.TestResult.run(TestResult.java:109)
     at junit.framework.TestCase.run(TestCase.java:118)
     at junit.framework.TestSuite.runTest(TestSuite.java:208)
     at junit.framework.TestSuite.run(TestSuite.java:203)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Similar Messages

  • What is cannot be resolved to a type error?

    When i run jsp programs, am getting :
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 6 in the jsp file: /dbcoffee.jsp
    Generated servlet error:
    CoffeeQBean cannot be resolved to a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    what does cannot be resolved to a type mean?

    I am getting the same error but while creating a Web Service.
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         org.apache cannot be resolved to a type
         _service cannot be resolved
         _serviceClient cannot be resolved
         _serviceClient cannot be resolved
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         _serviceClient cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         The constructor TemperatureConverterStub(null, String) is undefined
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         _operations cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         at ws.example.TemperatureConverterStub.<init>(TemperatureConverterStub.java:17)
         at ws.example.TemperatureConverterServiceClient.main(TemperatureConverterServiceClient.java:8)If you want I can post the files too.

  • Eclipse "cannot be resolved to a type" and new .JAR lib - config prob?

    I'm trying to make use of the Commons HttpClient library in a project being built in Eclipse (3.1). I have a sample program (PostXML) that runs into "cannot be resolved to a type" on the "HttpClient" object. I think the problem is that the JRE 1.4.2 (Mac OS-X) system library includes an earlier release (3.0.1) of the HttpClient, but some of the classes used by PostXML are in the 3.1rc of HttpClient. I've downloaded the newer release, created a user library, and modified the load order so I can see the user library above (i.e. loaded prior to?) the System JRE in the package browser. I can see the HttpClient.class in the Package browser. I have "import org.apache.commons.httpclient.methods.*;" in the head of the application (that took tweaking). Several of the HttpClient methods resolve correctly, but not the HttpClient object constructor itself. I am also finding I cannot simply import all the HttpClient methods, but must import each explicitly (?). Suggestions?

    I have gotten the sample code to compile and run,
    though I still have some confusion about needing the
    explicit imports (as compared to a wildcard import).
    In the end I believe my "cannot be resolved to a
    type" error was due to dependencies within the
    HttpClient library on the commons-codec library. Once
    I downloaded and installed that, the samples started
    working better. Still trying to understand the API,
    but making progress.when downloading third-party libraries, check the download page to see if it has any further dependencies. apache libraries are notoriously dependent on other apache libraries
    regarding the imports, it's not that there's a need for explicit imports, it's more that wildcard imports are a bad idea. explicit imports gives other people looking at your code a first clue as to what it does, and it also can serve as an indicator that your class is too big, if there are lots of imports. wildcards hide this from you. apart from that, it makes no difference to your code, and imports don't even exist at runtime so it affects how your code actually runs, not at all

  • HashTable cannot be resolved to a Type

    Hey Guys,
    I want to use a HashTable to assign Integer object values to the to String keys defined by the getActionCommand() methods of an array of JButtons. Now I tried to construct a HashTable like this:
    private HashTable<String, Integer> commandParser = new HashTable<String, Integer>();Eclipse gives me the error "HashTable cannot be resolved to a Type" .
    I thought I had done it all as was stated in the APIs. What?s wrong here?
    Sum1 hlp pls i cant figger ths oot ;-)
    EDIT: While I?m here, I get a warning:
    The serializable class BuildPane does not declare a static final serialVersionUID field of type long
    for every one of my classes.
    What is that about? I ignored it because it?s just a warning, but always safe, never sorry.
    Edited by: AikmanAgain on Mar 29, 2008 5:29 AM

    AikmanAgain wrote:
    Hey Guys,
    I want to use a HashTable to assign Integer object values to the to String keys defined by the getActionCommand() methods of an array of JButtons. Now I tried to construct a HashTable like this:
    private HashTable<String, Integer> commandParser = new HashTable<String, Integer>();Eclipse gives me the error "HashTable cannot be resolved to a Type" .
    I thought I had done it all as was stated in the APIs. What?s wrong here?There is no class called HashTable in the JRE. Look again ... and remember Java is case sensitive.
    The serializable class BuildPane does not declare a static final serialVersionUID field of type long
    for every one of my classes.
    What is that about? I ignored it because it?s just a warning, but always safe, never sorry.The serialVersionUID is a field that's used in serialization (as the name and the warning should have suggested).
    Google for any serialization tutorial and you'll learn what it's good for.

  • Class name cannot be resolved to a type

    Dear All,
    I have one main class calling another class but I keep getting this error "
    SMSClient cannot be resolved to a type". Before this I tried on other pc it was ok. Below is part of the codes. What could have been wrong? Can it be a missing library but how to trace that?
    public class callSMSClient{   public static void main(String[] args)  {       
              SMSClient t1 = new SMSClient(0);       
              t1.sendMessage("+6065544223","testing one two");  }}public class callSMSClient
              public static void main(String[] args)
           SMSClient t1 = new SMSClient(0);
           t1.sendMessage("+6065544223","testing one two");
    public class SMSClient implements Runnable{  
    public final static int SYNCHRONOUS=0; 
    public final static int ASYNCHRONOUS=1; 
    private Thread myThread=null;  
    private int mode=-1; 
    private String recipient=null; 
    private String message=null;  
    public int status=-1; 
    public long messageNo=-1;   
    public SMSClient(int mode) {     
    this.mode=mode;   
    public int sendMessage (String recipient, String message)
          this.recipient=recipient;   
          this.message=message;  
          myThread = new Thread(this);   
          myThread.start();
          //    run();   
          return status;   
    public void run()
    Sender aSender = new Sender(recipient,message);    
    try{     
    //send message         
    aSender.send ();         
    // System.out.println("sending ... ");      
    //in SYNCHRONOUS mode wait for return : 0 for OK, -2 for timeout, -1 for other errors     
    if (mode==SYNCHRONOUS)
    while (aSender.status == -1)
    {            myThread.sleep (1000);         
    if (aSender.status == 0)
    messageNo=aSender.messageNo ;   
    catch (Exception e)
    {         e.printStackTrace();    
    this.status=aSender.status ;    
    aSender=null;   
    }public class SMSClient implements Runnable{
      public final static int SYNCHRONOUS=0;
      public final static int ASYNCHRONOUS=1;
      private Thread myThread=null;
      private int mode=-1;
      private String recipient=null;
      private String message=null;
      public int status=-1;
      public long messageNo=-1;
      public SMSClient(int mode) {
          this.mode=mode;
      public int sendMessage (String recipient, String message){
        this.recipient=recipient;
        this.message=message;
        //System.out.println("recipient: " + recipient + " message: " + message);
        myThread = new Thread(this);
        myThread.start();
    //    run();
        return status;
        public void run(){
        Sender aSender = new Sender(recipient,message);
        try{
          //send message
              aSender.send ();
             // System.out.println("sending ... ");
          //in SYNCHRONOUS mode wait for return : 0 for OK, -2 for timeout, -1 for other errors
          if (mode==SYNCHRONOUS) {
              while (aSender.status == -1){
                myThread.sleep (1000);
          if (aSender.status == 0)
             messageNo=aSender.messageNo ;
        }catch (Exception e){
            e.printStackTrace();
        this.status=aSender.status ;
        aSender=null;
    }

    Dear Ejp,
    I would like to first share a simple case here first. Below is the simplied codes. Here I dont need any import statement. I keep both this in the same directory. I am using this command to compile javac callSMSClient.java. Why even this simple case is not working?
    public class callSMSClient{
      public static void main(String[] args)
           SMSClient t1 = new SMSClient(1);
           t1.sendMessage("+6014466044","testing one two");
    public class SMSClient {
      private int mode=-1;
      private String recipient=null;
      private String message=null;
      public SMSClient(int mode) {
          this.mode=mode;
      public void sendMessage (String recipient, String message){
        this.recipient=recipient;
        this.message=message;
        System.out.println("recipient: " + recipient + " message: " + message);
    }

  • Some class that cannot be resolved to a type

    Hello, I?m trying to use the[b] itext API for PDF creating from Java.
    In order to do this you must include the package .jar in your classpath and import com.logawie.text.* in your java file. All this steps are obviusly, and work correctly, in JAVA, but i?m trying to develope a web application, using JSP.
    Usually when I try to import a package from a JAR file that are allocated in the C:\j2sdk1.4.2_12\lib directory it doesn?t work. I solved this problem with some classes including it directly to the src.zip file. But with the itext package it doesn?t work, I don?t know if my solution is too bad, but with another classes it works, but with the itext package it says that all classes references "cannot be resolved to a type".
    Anyone can help me? Thanks in advance.

    when i try to depooy it then error comes
    user cannot be resolved to a type
    can any body help me
    and tell me about classpath
    //UserData.java
    package user;
    public class UserData {
    String username;
    String email;
    int age;
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    //GetName.jsp
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    //NextPage.jsp
    <jsp:useBean id="user" class="user.UserData" scope="session"/>
    <HTML>
    <BODY>
    You entered<BR>
    Name: <%= user.getUsername() %><BR>
    Email: <%= user.getEmail() %><BR>
    Age: <%= user.getAge() %><BR>
    </BODY>
    </HTML>
    //SaveName.jsp
    <jsp:useBean id="user" class="user.UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <HTML>
    <BODY>
     Continue<font face="Arial"> </font>
    </BODY>
    </HTML>

  • FileDataSource cannot be resolved to a type (client application)

    Hi,
    I'm trying to send a file to a (rpc) web-service. My client java application does it with the following code.
    mySoapProxy.myMethod(new DataHandler(new FileDataSource(filename)));
    The error stated is the following:
    "FileDataSource cannot be resolved to a type"
    And I do have imported all classes from javax.activation package.
    Do you have any idea?
    Thanks

    Hi,
    I'm trying to send a file to a (rpc) web-service. My client java application does it with the following code.
    mySoapProxy.myMethod(new DataHandler(new FileDataSource(filename)));
    The error stated is the following:
    "FileDataSource cannot be resolved to a type"
    And I do have imported all classes from javax.activation package.
    Do you have any idea?
    Thanks

  • ParserException cannot be resolved to a type ??

    Hi all,
    What is the problem in the following code ? eclipse says "ParserException cannot be resolved to a type"
    thanks,
    import org.htmlparser.*;
    public class test {
         public static void main(String[] args) {
              String x = extractStrings("http://www.yahoo.com");
              System.out.println(x);
         public static String extractStrings(String html) throws ParserException {
              StringBuffer result = new StringBuffer();
              Parser parser = Parser.createParser(html, null);  // charset=null??
              //String encoding = parser.getEncoding();
              //System.out.println(encoding);
              Node node;
              StringBuffer results = new StringBuffer();
              for (org.htmlparser.util.NodeIterator e = parser.elements(); e.hasMoreNodes();) {
                   node = e.nextNode();
                   result.append(node.toPlainTextString());
              return result.toString();
    }

    So what should i do ?Did you write that 'extractStrings()' method yourself? As you can see,
    this method may throw a ParserException which is a checked exception.
    You either should catch it in your main method or you should declare
    that your main method can throw that same exception by adding it to
    its throws-clause, identical as you did for the extractStrings method.
    kind regards,
    Jos

  • MyClass cannot be resolved to a type

    am looking to call a java class from within a servlet but am having this error on compilation: "MyClass" cannot be resolved to a type.
    my code look like follows showing the file path where am using eclipse :
    <eclipse>/workspace/MyApp/src/pal/MyClass.java
    package pal;
    public class MyClass
        public MyClass()
    }<eclipse>/workspace/MyApp/src/pal/MyServlet.java
    package pal;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class MyServlet extends HttpServlet
         public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws IOException, ServletException
              new MyClass();
    }what did i miss?

    Personally I dislike Netbeans, I found it to be ugly, non-intuitive and buggy. I already threw it away from my system after only 5 mins of testing. It's only good for ones who are really, really new to Java and by a coincidence got Netbeans in the JDK pack, and/or followed the Sun tutorials wherein Netbeans is pushed up, and/or still know nothing about the existence of other IDE's and what they all provides.

  • PasswordHandler cannot be resolved to a type

    Hi i am doing using ldap
    I am getting error of
    PasswordHandler cannot be resolved to a type
    at the line
    PasswordHandler pHandler = PasswordHandler.getInstance();Am I missing any jar files or ?
    pls help

    looks like there are several passwordhandler class
    take a look at:
    [http://www.google.fr/search?hl=fr&client=firefox-a&rls=org.mozilla%3Afr%3Aofficial&hs=LWd&q=api+passwordhandler+getinstance&btnG=Rechercher&meta=]
    from the code you gave, we can only see that a "getinstance" method is available in the class ; if other methods are invoked later in the code, add those method names as keywords in google to narrow the result scope

  • BankAccount cannot be resolved to a type

    hello,
    public class Bank
      // attributes
      private BankAccount[] list; // to hold the accounts
      private int total; // to keep track of the number of accounts in the list
      // methods
      // the constructor
      public Bank(int sizeIn)
        // size array with parameter
        list = new BankAccount[sizeIn];
        total = 0;
      // helper method to find the index of a specified account
      private int search(String accountNumberIn)
        for(int i = 0; i < total; i++)
          BankAccount tempAccount = list;
    when this program is compiling  the following error appears:
    BankAccount cannot be resolved to a type
    any ideas?
    thank you!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Think about it. What is the error telling you? It's really quite straightforward, if you overcome the mistaken belief that compiler output is some foreign language only extreme techies can understand.

  • DefaultHander cannot be resolved to a type

    Hello -
    I am using Eclipse to write a java mapping program but even before compilation, Eclipse IDE shows DefaultHandler as cannot be resolved to a type.
    I have done the following imports:
    import com.sap.aii.mapping.api.StreamTransformation;
    import org.xml.sax.*;
    import java.io.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import java.util.Map;
    import javax.xml.parsers.SAXParser;
    I have added only aii_map_api.jar in the External JAR's in Eclipse.
    What other imports should be done to avoid this error?
    Thanks,
    Tirumal

    Tirumal ,
    If you are getting the same error as you have written in the thread subject,
    <b>DefaultHander</b> cannot be resolved to a type , then note that if it is reffering to an imported class <b>DefaultHander</b> which should be <b>DefaultHandler</b>

  • EmailControl cannot be resolved to a type

    Hi,
    We upgrade an WLW 8.1 application with a simple EmailControl from WLW 8.1 to WLW 10.3 and we get the error :
    +"EmailControl cannot be resolved to a type"+
    The import wizard imported a trivial WLW 8.1 with a simple call to the emailControl.
    What can be wrong and what should we add to get this emailControl working in WLW10.3 ?
    Thanks
    Yves
    ############# code ############
    package controls;
    import org.apache.beehive.controls.api.bean.ControlExtension;
    import weblogic.jws.*;
    import com.bea.control.*;
    import org.apache.xmlbeans.XmlObject;
    * A custom Email control.
    * @jc:email smtp-address="localhost:25"
    * from-address="[email protected]"
    * from-name="The Sender"
    * reply-to-address="[email protected]"
    * reply-to-name="ReplyName YYYY"
    * header-encoding=""
    * username=""
    * password=""
    @ControlExtension()
    public interface EmailSuperManager extends EmailControl
    * @jc:send-email to="{to}"
    * subject="{subject}"
    * body="{body}"
    * content-type="text/plain"
    void sendEmail( String to,
    String subject,
    String body);
    }

    user5184649 wrote:
    What can be wrong ...
    Wrong forum for this question.

  • Shape cannot be resolved to a type

    Hi all,
    For my current programming in eclipse 3.1.0, I'm using an open source class. Within that class, the object 'newShape' of class 'Shape' is declared. When compiling, the following error message occurs:
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         Only a type can be imported. java.awt resolves to a package
         Shape cannot be resolved to a type
         newShape cannot be resolved
    want does that mean? Does anybody has an answer?
    Thanks in advance,
    Andreas

    Hi DrLaszloJamf,
    you were right I had 'import java.awt;' in my code. But even without it, the problem remains. Listed below are the critical codelines.
    import java.awt.Graphics;
    import java.awt.Image;
    import java.awt.event.ComponentEvent;
    import java.awt.event.ComponentListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseMotionAdapter;
    import java.util.Enumeration;
    import java.util.Vector;
    public class CellGridCanvas extends Canvas {
    private boolean cellUnderMouse;
    private Image offScreenImage;
    private Graphics offScreenGraphics;
    private Image offScreenImageDrawed;
    private Graphics offScreenGraphicsDrawed;
    private int cellSize;
    private CellGrid cellGrid;
    private Vector listeners;
    private int newCellSize;
    private Shape newShape;
    The error message 'Shape cannot be resolved to a type' refers to the last line, where object 'newShape' is declared.

  • 'Jpanel' cannot be resolved to a type error

    Hi all,
    I need to pass a Jpanel to an object. I have added my code below.
    public void createFrame(Object panel){
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.getContentPane().add( (Jpanel)panel);
              frame.pack();
              frame.setVisible(true);
         }In this
    frame.getContentPane().add( (Jpanel)panel);shows error as 'Jpanel' cannot be resolved to a type.
    What is the correct approach for this?
    Please help.
    Rony

    Also, why is your method parameter an Object? Why not a JPanel or at least a JComponent?

Maybe you are looking for