×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Nov 2010
    Posts
    93

    Thumbs up Class Cast java/lang/Class Cast Exception while run my Application

    I have an error while run my Application.

    "Class Cast java/lang/Class Cast Exception"

    My coding model:

    public void startApp()
    {
    if(!fcon.exists())
    {
    Home he1=new Home();
    he1.myApp(); //myApp() is a method present in another class
    }

    if(fcon.exists())
    {
    String s=language();// this method check and return selected language string

    if(s.equalsIgnoreCase("English"))
    {
    Home ht1=new Home();
    ht1.myApp(); // ERROR OCCURRED IN THIS LINE
    }

    }
    }

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Class Cast java/lang/Class Cast Exception while run my Application

    I don't think this error occurs at that line of code. Maybe it occurs inside the myApp() method.

    This error occurs when you use a construction like:

    Code:
    SomeClass c = (SomeClass) someObject;
    When "someObject" is not of a type compatible with "SomeClass".

    Graham.

Similar Threads

  1. Class Cast error
    By Viocartman in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2010-06-07, 17:12
  2. Class Cast Exception in writing tag
    By honest_success in forum Near Field Communication
    Replies: 0
    Last Post: 2009-07-10, 05:37
  3. java.lang.Error: ClassFormatError, java.lang.Class..unknown.()
    By kadro in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2007-08-23, 06:19
  4. 6131NFC SDK1.1 Class cast exception on Custom Data Source
    By steview in forum Tools and SDK Feedback (Closed)
    Replies: 0
    Last Post: 2007-08-13, 22:07
  5. SOAP Response : Cast Exception in Client
    By omago in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-04-07, 21:26

Posting Permissions

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