Forum Stats

  • 3,852,275 Users
  • 2,264,086 Discussions
  • 7,905,017 Comments

Discussions

How to fix class loading error: Abstract and native methods cannot have code

big_otts
big_otts Member Posts: 1
edited Feb 23, 2019 1:44AM in Java ME SDK

I am attempting to do some hello world type apps in Java ME in Netbeans 7.4 (because 8.0 gives me a million more errors when I run anything), however when I attempt to run my app it gives me the error Error preverifying class javax.microedition.midlet.MIDlet Class loading error: Abstract and native methods cannot have code
I'm not good at coding and I decided to try changing some classes to abstract without fully knowing what I was doing and whatnot, but that didn't work.

Here is the code

package EPIC;  <br/>import javax.microedition.lcdui.*; <br/>import javax.microedition.midlet.*; <br/><br/>public class MyFirstApplication extends MIDlet { <br/>private StringItem si; <br/>private Form myform;  <br/><br/>public void startApp() { <br/>si = new StringItem("hello","world"); <br/>myform = new Form("form");<br/> myform.append(si); Display.getDisplay(this).setCurrent(myform); <br/>}  <br/><br/>public void pauseApp() {<br/><br/>}  <br/>public void destroyApp(boolean unconditional) {<br/><br/>  }<br/> } 

Any help or tips is appreciated.

(P.S If you have see this post on any other forums, that is because I am trying to get this project fixed quickly, as I waited many days on Stack Overflow already and i'm getting bored and impatient. Please try not to get these posts confused)

Tagged: