Java ME Kann mein Projekt nicht mehr ausführen?

bruce85

Bekanntes Mitglied
Hallo nochmal,
ich hab ein großes Problem, ich hab mich verklickt bei dem Wireless Toolkit und ausversehen auf Project->Run via OTA geklickt.
Jetzt wenn ich mein Projekt Kompiliere und es anschließend ausführen möchte, funktioniert es nicht mehr.
Kompilieren geht ohne Fehler, aber wenn das Phone Tool auf geht und ich es dann starten möchte, dann erhalte ich folgende Fehlermeldung:
Code:
Running with storage root C:\Users\Name\j2mewtk\2.5.2\appdb\DefaultColorPhone
Running with locale: German_Germany.1252
Running in the identified_third_party security domain
Unable to create MIDlet Test
java.lang.ClassNotFoundException: Test
	at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
	at com.sun.midp.midlet.Selector.run(+22)

Ich habe schon versucht das Programm neu zu installieren und habe sogar die gespeicherte Daten gelöscht und neu erstellt, leider hilft das alles nix.

Ich komme echt nicht mehr weiter, kann mir Vielleicht jemand helfen, wo das Problem liegen könnte?

Ich danke euch schonmal.

Edit: Ich hab das Problem gelöst.
Ich hab irgendwie versucht ein package zu laden, jetzt habe ich das gelöscht und es geht.
Java:
package java.awt.font;

MfG
 
Zuletzt bearbeitet:

bruce85

Bekanntes Mitglied
Hallo nochmal,
ich habe nur noch ein kleines Problem und zwar, wenn ich ein Array erstelle und darauf zugreifen möchte, dann bleibt mein Programm einfach hängen.
Hier der Fehler:
Java:
Running with storage root C:\Users\Name\j2mewtk\2.5.2\appdb\DefaultColorPhone
Running with locale: German_Germany.1252
Running in the identified_third_party security domain
java.lang.NullPointerException
	at MyCanvas.paint(+8)
	at javax.microedition.lcdui.Canvas.callPaint(+85)
	at javax.microedition.lcdui.Display.repaint(+82)
	at javax.microedition.lcdui.Display.registerNewCurrent(+235)
	at javax.microedition.lcdui.Display.access$700(+6)
	at javax.microedition.lcdui.Display$DisplayAccessor.foregroundNotify(+46)
	at javax.microedition.lcdui.Display$DisplayManagerImpl.notifyWantsForeground(+152)
	at javax.microedition.lcdui.Display$DisplayManagerImpl.access$100(+6)
	at javax.microedition.lcdui.Display.setCurrent(+70)
	at Trainingsplan.startApp(+18)
	at javax.microedition.midlet.MIDletProxy.startApp(+7)
	at com.sun.midp.midlet.Scheduler.schedule(+270)
	at com.sun.midp.main.Main.runLocalClass(+28)
	at com.sun.midp.main.Main.main(+80)
Execution completed.
3439510 bytecodes executed

Und hier mal ein teil von meinem Code:
Java:
class MyCanvas extends Canvas {
         private class TListe {
                 String Tag;
                 String Datum;
         }

         TListe Liste[] = new TListe[1];
         public void paint(Graphics g) {
                 Liste[0].Tag = "Montag";

                 g.setColor(127,127,127);
                 g.fillRect(0,0,getWidth(),getHeight());

                 Font aFont;
                 aFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE);
                 g.setFont(aFont);
                 g.setColor(255,255,255);
                 g.drawString("Tag",(getWidth()/2)-((getWidth()/2)/2)-(aFont.stringWidth("Tag")/2),0,g.TOP|g.LEFT);
                 g.drawString("Datum",(getWidth()/2)+((getWidth()/2)/2)-(aFont.stringWidth("Datum")/2),0,g.TOP|g.LEFT);
                 int zaehler = 0;
                 for (int i=0; i<1; i++) {
                         zaehler = 1 - zaehler;
                         if (zaehler == 0) {
                                 g.setColor(0,255,255);
                         } else {
                                 g.setColor(0,0,255);
                         }
                         g.fillRect(0, i*21+21, getWidth(), 20);
                         g.setColor(255,255,255);
                         g.drawString("Montag",(getWidth()/2)-((getWidth()/2)/2)-(aFont.stringWidth("Montag")/2),i*21+21,g.TOP|g.LEFT);
                         g.drawString("22.11.2011",(getWidth()/2)+((getWidth()/2)/2)-(aFont.stringWidth("22.11.2011")/2),i*21+21,g.TOP|g.LEFT);
                         //g.drawString(Liste[i].Tag,(getWidth()/2)-((getWidth()/2)/2)-(aFont.stringWidth(Liste[i].Tag)/2),i*21+21,g.TOP|g.LEFT);
                 }
                 g.setColor(255,255,255);
                 g.drawLine(0,20,240,20);
                 g.drawLine(120,0,120,320);
         }
}

Bei der Zeile 9 ist der Fehler.
Ich greife auf ein Array zu, die nicht existiert oder so.
Ich möchte einfach einen Array erstellen, die weitere Eigenschaften haben, so wie ich es hier auch versucht habe mit class TListe.

Ich danke euch schonmal für die Hilfe.

MfG
 

schlingel

Gesperrter Benutzer
Du musst deine Liste eben noch initialisieren.

Du hast da einen klassischen Fehler gemacht. Du instanzierst ja nur das Array, allerdings nicht die Elemente. Wenn du also schreibst:

Java:
TListe Liste[] = new TListe[1];

Dann erzeugst du ein Array das so aussieht: { null }

Am besten ist es du packst das Initialisieren in den Konstruktor:

Java:
class MyCanvas extends Canvas {
         private class TListe {
                 String Tag;
                 String Datum;
         }
 
         private TListe[] tagesListe; // Das ist Java, kein C ;-) => also sprechende Namen verwenden

         public MyCanvas() {
              super();
              initialize();
         }

         public MyCanvas(GraphicsConfiguration config) {
              super(config);
              initialize();
         } 

         private void initialize() {
             // Array initialisieren
             tagesListe = new TListe[1]();
             // Element initialisieren
             tagesListe[0] = new TListe();
             tagesListe[0].Tag = "Freitag";
             tagesListe[0].Datum = "12.12.2012";
         }
         [...]
         /* Dein paint kann gleich bleiben außer das Liste jetzt tagesListe heißt */
 

bruce85

Bekanntes Mitglied
Vielen Dank.
Irgendwie bekomme ich einen Fehler, wenn ich es Kompilieren möchte:
Java:
';' expected
             tagesListe = new TListe[1]();

Woran könnte das liegen?

MfG
 

schlingel

Gesperrter Benutzer
Ups, das sollte

Java:
tagesListe = new TListe[1];

und nicht

Java:
tagesListe = new TListe[1]();

sein.
 

bruce85

Bekanntes Mitglied
Vielen Dank.
So schlau war ich auch schon, aber dann hat mir der Kompiler diesen Fehler angezeigt:
Java:
cannot find symbol
symbol  : class GraphicsConfiguration
location: class MyCanvas
         public MyCanvas(GraphicsConfiguration config) {
                         ^
1 error

Jetzt hab ich "MyCanvas(GraphicsConfiguration config)" einfach mal entfernt und jetzt funktioniert es.

Ich danke dir Vielmals für die Hilfe.

MfG
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
N Wie kann ich mein Handy mit Java rooten? Android & Cross-Platform Mobile Apps 38
V Android Wird mein Vorhaben funktionieren? (Apk Datei decompilieren, bearbeiten, compilieren) Android & Cross-Platform Mobile Apps 2
B Android Mein Standort (WhatsApp) mit meiner MapApp öffnen Android & Cross-Platform Mobile Apps 0
W Frisch generiertes Projekt Value nicht findbar NavController Drawer Android & Cross-Platform Mobile Apps 12
ruutaiokwu Wie fügt man bei Android Studio .jar-Libraries zu einem Android-Java-Projekt hinzu? Android & Cross-Platform Mobile Apps 33
F Projekt mit GIT auf anderen Rechner umgezogen Android & Cross-Platform Mobile Apps 2
B Android Projekt für Android und IOS erstellen? Android & Cross-Platform Mobile Apps 5
L Mit Java ein Android Projekt kompilieren Android & Cross-Platform Mobile Apps 6
B AdMob im Projekt einbinden? Android & Cross-Platform Mobile Apps 3
D Android Game Projekt Android & Cross-Platform Mobile Apps 15
G Android Einbindung von externen Dateien in Eclipse Projekt Android & Cross-Platform Mobile Apps 8
U Android Jar-File einbinden vs. externes Projekt Android & Cross-Platform Mobile Apps 7
R Android Mehrere TabHosts im gleichen Projekt Android & Cross-Platform Mobile Apps 4
J Projekt: Mobile Endsysteme Fragen Android & Cross-Platform Mobile Apps 2
F Externe Bibliotheken in Projekt einbinden Android & Cross-Platform Mobile Apps 5
2 Netbeans Handy Projekt läuft nicht auf Handy! Android & Cross-Platform Mobile Apps 3
W MoveEvent reagiert nicht Game Android & Cross-Platform Mobile Apps 1
W Reward Ads AdMob wird nicht ausgeliefert. Android & Cross-Platform Mobile Apps 9
W Cookie Manger übermittelt nicht Android & Cross-Platform Mobile Apps 1
J Spinner wird nicht aktualisiert Android & Cross-Platform Mobile Apps 6
M PythonInterpreter funktioniert nicht richtig NoClassDefFoundError Android & Cross-Platform Mobile Apps 1
I Android SharedPreferences wenn App auf externem Speicher klappt nicht Android & Cross-Platform Mobile Apps 0
ImageView wird nicht angezeigt Android & Cross-Platform Mobile Apps 4
W WebView Linkvertise lädt nicht richtig oder bleibt grau Android & Cross-Platform Mobile Apps 10
W AlertDialog Eigenschaften existiert nicht mehr. Android & Cross-Platform Mobile Apps 14
W Wieso gehen Log nicht im Service? Android & Cross-Platform Mobile Apps 20
R Android Do not disturb: Sound wird nicht abgespielt Android & Cross-Platform Mobile Apps 2
O Google Admob Ad wird nicht geladen und App stürzt ab Android & Cross-Platform Mobile Apps 1
I Android ListView (Custom) soll auf Hardwaretasten nicht reagieren. Android & Cross-Platform Mobile Apps 10
CT9288 Zufällige Zahlengenerierung scheint nicht richtig zu funktionieren Android & Cross-Platform Mobile Apps 5
M App crasht und ich bekomme es nicht behoben.:( Android & Cross-Platform Mobile Apps 17
M Paper DB wird in Android Studio nicht erkannt Android & Cross-Platform Mobile Apps 7
K Android Android In-App-Purchase lädt nicht Android & Cross-Platform Mobile Apps 0
Besset Android http request an interne ip adresse funktioniert nicht Android & Cross-Platform Mobile Apps 8
R Android Visualizer engine kann nicht initialisiert werden Android & Cross-Platform Mobile Apps 3
OSchriever Navigation drawer Strings ändern sich nicht Android & Cross-Platform Mobile Apps 0
W Code läuft unter SDK 27 aber nicht SDK 30 Android & Cross-Platform Mobile Apps 17
N Android Ich kann mit meiner App nicht auf die Datenbank zugreifen Android & Cross-Platform Mobile Apps 4
A GraphView => X- und Y-Achse wird nicht angezeigt Android & Cross-Platform Mobile Apps 5
ruutaiokwu Android Selbst entwickelter SMTP-Client läuft auf PC, nicht aber auf Android Android & Cross-Platform Mobile Apps 9
W Android Wieso geht getApplicationContext() bei Toast, aber nicht bei AlertDialog.Builder? Android & Cross-Platform Mobile Apps 36
A Android Studio: while-Schleife beginnt nicht Android & Cross-Platform Mobile Apps 5
A jpg wird im Android Studio nicht akzeptiert Android & Cross-Platform Mobile Apps 3
T Android SDK-Manager startet nicht in Eclipse Android & Cross-Platform Mobile Apps 5
J Download und speichern mit jsch klappt nicht Android & Cross-Platform Mobile Apps 5
J Service starte nicht mehr Android & Cross-Platform Mobile Apps 13
Arif Android Radiobutton wird nicht deaktiviert Android & Cross-Platform Mobile Apps 1
Arif Android Canvas wird nicht gezeichnet? Android & Cross-Platform Mobile Apps 0
J Notification wird nicht angezeigt wenn App nicht offen ist. Android & Cross-Platform Mobile Apps 6
J Firebase und Emulator startet nicht Android & Cross-Platform Mobile Apps 2
L ListView aktuallisiert sich nicht Android & Cross-Platform Mobile Apps 15
J ArrayAdapter zeigt Liste nicht an Android & Cross-Platform Mobile Apps 0
L Android Animationen werden nicht angezeigt Android & Cross-Platform Mobile Apps 0
Excess Android Service läuft nicht in Sandby weiter Android & Cross-Platform Mobile Apps 2
W Preview wird nicht korrekt angezeigt Android & Cross-Platform Mobile Apps 0
B Profilpic wird nach anmeldung nicht angezeigt. Android & Cross-Platform Mobile Apps 2
K Methode wird nicht gefunden Android & Cross-Platform Mobile Apps 1
J App funktioniert auf Android 5, auf 6 nicht Android & Cross-Platform Mobile Apps 2
K Log.v geht nicht Android & Cross-Platform Mobile Apps 4
J Kamera - Foto wird nicht gespeichert Android & Cross-Platform Mobile Apps 2
L Android Android Studio - Exportierte APK funktioniert nicht Android & Cross-Platform Mobile Apps 6
L Android Methode funktioniert nicht unter Android Android & Cross-Platform Mobile Apps 3
L Android Java scheint XML nicht zu finden Android & Cross-Platform Mobile Apps 11
J android Spinner funktioniert nicht Android & Cross-Platform Mobile Apps 14
B Android osmdroid möchte nicht das es mapnik herunterlädt Android & Cross-Platform Mobile Apps 2
apple_pie1998 SharedPreferences funktionieren nicht... Android & Cross-Platform Mobile Apps 17
S Android neue Version des Programms wird nicht in Emulator geladen Android & Cross-Platform Mobile Apps 1
B Android Textdatei laden (klappt nicht) Android & Cross-Platform Mobile Apps 4
O Android Switch Widget wird nicht angezeigt Android & Cross-Platform Mobile Apps 1
M Android ListView wird nicht dargestellt Android & Cross-Platform Mobile Apps 2
S Android null pointer (ich verstehs nicht) Android & Cross-Platform Mobile Apps 2
S Android Emulator startet nicht vollständig. Android & Cross-Platform Mobile Apps 0
S Neue Activity lässt sich nicht starten Android & Cross-Platform Mobile Apps 28
M Notification nicht mehr senden nachdem sie geklickt wurde Android & Cross-Platform Mobile Apps 0
D Android Tabs nutzen - PagerTitleStrip haut nicht hin Android & Cross-Platform Mobile Apps 4
K MediaPlayer Soundklasse Start und Stop (stop funktioniert nicht) Android & Cross-Platform Mobile Apps 1
O Android Anfänger: Quellcode nicht gefunden Android & Cross-Platform Mobile Apps 3
B Timer geht nicht Android & Cross-Platform Mobile Apps 2
S Umlaute werden trotz UTF-8 nicht angezeigt? Android & Cross-Platform Mobile Apps 6
S SPLIT funktion bei STRING funktioniert nicht! Android & Cross-Platform Mobile Apps 4
J Android Breaking Point in Eclipse hält nicht an? Android & Cross-Platform Mobile Apps 5
J Android SimpleDateFormat parser funktioniert nicht richtig? Android & Cross-Platform Mobile Apps 4
L Android Apache POI: Datei speichern geht nicht Android & Cross-Platform Mobile Apps 1
Y Erstes kleines Android Programm will nicht so recht... Android & Cross-Platform Mobile Apps 1
S Foto-app hält galerie nicht aktuell Android & Cross-Platform Mobile Apps 9
D Man sieht nicht ob Button gedrückt wurde! Android & Cross-Platform Mobile Apps 10
L Android Multitouch will einfach nicht, was mach ich falsch? Android & Cross-Platform Mobile Apps 1
B AlarmManager triggert nicht jede Stunde Android & Cross-Platform Mobile Apps 7
B Erste Android-App: setContentView(R.layout.main) funktioniert nicht Android & Cross-Platform Mobile Apps 6
N Android EditText.setError() funktioniert nicht nach Rotation Android & Cross-Platform Mobile Apps 1
K OnItemLongClickListener in ListActivity spricht nicht an Android & Cross-Platform Mobile Apps 8
N Android Display nicht löschen bzw. neu laden Android & Cross-Platform Mobile Apps 2
J Handy bootet nicht mehr richtig Android & Cross-Platform Mobile Apps 2
D Android OnClickListener funktioniert auf LinearLayout nicht Android & Cross-Platform Mobile Apps 6
X Android Warum werden Views nicht gefunden? Android & Cross-Platform Mobile Apps 4
D Android App startet nicht Android & Cross-Platform Mobile Apps 24
F Android ArrayList nicht funktional in Android!? Android & Cross-Platform Mobile Apps 6
E Datenbankanfrage findet Tabel nicht Android & Cross-Platform Mobile Apps 3
S Android LogCat Ausgaben in Schleife geht nicht? Android & Cross-Platform Mobile Apps 2
schlingel Android Warum man Apps beenden sollte bzw. es nicht tun sollte Android & Cross-Platform Mobile Apps 4

Ähnliche Java Themen

Neue Themen


Oben