Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    17

    ClassFormatError compiling and running a Java (Mobile) prog?

    When I run a Java Mobile program (CLDC 1.0, MIDP 2.0) I've been writing I get the following output (see below) from the JavaME Platform SDK 3.0 JavaME phone emulator, in the Eclipse Console. However, when I run exactly the same code in Netbeans 7.0, also using the exact same Java Platform SDK emulator, everything just runs as it should. Weird!

    Anyone got any clues please? Thank you.

    Output in Eclipse console:


    Installing suite from: http://127.0.0.1:64391/AlphaMobile.jad

    ****warning****
    ****Untrusted user classes must never be put
    ****on the system class path
    ****warning****

    TRACE: <at java.lang.Error: ClassFormatError: 154>, startApp threw an Exception
    java.lang.Error: ClassFormatError: 154
    - java.lang.Class.invoke_verify(), bci=0
    - java.lang.Class.initialize(), bci=117
    - AlphaMain.startApp(), bci=0
    - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
    - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
    java.lang.Error: ClassFormatError: 154
    - java.lang.Class.invoke_verify(), bci=0
    - java.lang.Class.initialize(), bci=117
    - AlphaMain.startApp(), bci=0
    - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
    - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26

  2. #2
    Regular Contributor
    Join Date
    Mar 2011
    Location
    Pune,Maharashtra,India
    Posts
    92

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    Quote Originally Posted by alexkerr View Post
    When I run a Java Mobile program (CLDC 1.0, MIDP 2.0) I've been writing I get the following output (see below) from the JavaME Platform SDK 3.0 JavaME phone emulator, in the Eclipse Console. However, when I run exactly the same code in Netbeans 7.0, also using the exact same Java Platform SDK emulator, everything just runs as it should. Weird!

    Anyone got any clues please? Thank you.

    Output in Eclipse console:


    Installing suite from: http://127.0.0.1:64391/AlphaMobile.jad

    ****warning****
    ****Untrusted user classes must never be put
    ****on the system class path
    ****warning****

    TRACE: <at java.lang.Error: ClassFormatError: 154>, startApp threw an Exception
    java.lang.Error: ClassFormatError: 154
    - java.lang.Class.invoke_verify(), bci=0
    - java.lang.Class.initialize(), bci=117
    - AlphaMain.startApp(), bci=0
    - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
    - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
    java.lang.Error: ClassFormatError: 154
    - java.lang.Class.invoke_verify(), bci=0
    - java.lang.Class.initialize(), bci=117
    - AlphaMain.startApp(), bci=0
    - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
    - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
    - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
    - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
    - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
    - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
    - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
    Can you specify,what you are doing in startApp methode?
    Regards,
    Pradip

  3. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    17

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    > Can you specify,what you are doing in startApp methode?

    startApp is just:


    protected void startApp() throws MIDletStateChangeException
    {
    AlphaCanvas ac = new AlphaCanvas();
    ac.mydisplay = Display.getDisplay(this); // Set local pointer to display, inside Canvas
    ac.am = this; // Set local pointer to midlet, inside Canvas

    Display.getDisplay(this).setCurrent(ac); // Must not be in midlet constructor above - AlphaMain()
    }

  4. #4
    Regular Contributor
    Join Date
    Mar 2011
    Location
    Pune,Maharashtra,India
    Posts
    92

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    Quote Originally Posted by alexkerr View Post
    > Can you specify,what you are doing in startApp methode?

    startApp is just:


    protected void startApp() throws MIDletStateChangeException
    {
    AlphaCanvas ac = new AlphaCanvas();
    ac.mydisplay = Display.getDisplay(this); // Set local pointer to display, inside Canvas
    ac.am = this; // Set local pointer to midlet, inside Canvas

    Display.getDisplay(this).setCurrent(ac); // Must not be in midlet constructor above - AlphaMain()
    }
    From your errors,I think you have not setted class paths properly.In eclips many of settings have to done manually.please see your class paths in properties of project
    Regards,
    Pradip

  5. #5
    Registered User
    Join Date
    Jan 2006
    Posts
    17

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    OK, thanks. Where would I change the class paths exactly in Project->Properties? I can't find the right settings. (and what do I change them to?)

    Also, if you're thinking of the warning where it says "****warning********Untrusted user classes must never be put****on the system class path****warning****", I'm not sure this is the issue - I've had that warning all through the development of the software over months and yet it is only in the last few days I've seen the ClassFormatError 154 and the app has refused to run in the JDK Emulator.

    Thanks.

  6. #6
    Super Contributor
    Join Date
    Mar 2003
    Posts
    4,110

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    Isn’t this a preverify issue?

  7. #7
    Registered User
    Join Date
    Apr 2014
    Posts
    1

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    Hi

    I am facing same issue , couple of month back my code was running perfectly fine.. but now i need to add few more functionality in Midlet . It start giving me this warning
    ****warning****
    ****Untrusted user classes must never be put
    ****on the system class path
    ****warning***

    My code is perfectly fine. But i am facing this issue . Might anyone here resolve this .. It will be great help.

    Thanks in advance.

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,806

    Re: ClassFormatError compiling and running a Java (Mobile) prog?

    Do you also have the ClassFormatError, or just the warning?
    According to http://docs.oracle.com/javase/7/docs...rmatError.html I tend to assume that ClassFormatError may indicate that the class files were compiled to a newer format than what the given JVM supports.
    Which JDK you are using? For example 1.8 may be too new for some purposes, I do not really know. If you are using Eclipse, you may want to check the compatibility settings in Project/Properties/Java Compiler.
    While this is a bit non-professional approach, you may consider a try with NetBeans.

Similar Threads

  1. Compiling and running a Qt program
    By SWEngineer in forum Qt
    Replies: 1
    Last Post: 2011-03-28, 11:25
  2. ALERT: java/lang/ClassFormatError: Bad version information
    By alifaghihi in forum Mobile Java Tools & SDKs
    Replies: 3
    Last Post: 2010-12-16, 10:56
  3. java/lang/ClassFormatError: Bad version information.
    By thngkl in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2009-05-15, 10:49
  4. 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
  5. help compiling and running an application
    By lucidness in forum Symbian
    Replies: 3
    Last Post: 2006-04-29, 23: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
  •  
×