Witam
piszę program w java ME j2me żeby można było odczytać z pliku tekstowego menu, tekst, obrazki itd.
mam na razie kod który odczytuje obrazki i tekst za pomocą swoich komend jak text i image

teraz chce dodać główne menu, żeby z pliku można było odczytać informacje o menu
pewien kod przerobiłem i po kompilacji program
wyskakuje mi błąd
"exception
the application has unexpectedly quit
contact the application provider to resolve the issue
0"

  1. jak odczytać lub jaki kod ma być, żeby uruchomił mi program główne menu z pliku tekstowego
    public void startApp()
    oto kod
package hello;
//   HelloMIDlet

import java.io.IOException;
import java.io.InputStreamReader;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;


import java.io.IOException;
import java.io.PrintStream;
import java.util.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
 
public class HelloMIDlet extends MIDlet implements CommandListener {
 
    private Form form;
    private Command wyjscie;
    private Command wstecz;
    private Command dalej;
    private Hashtable c;
    private Displayable displayable;
    
    String s1;
    
    public HelloMIDlet() {
        form = new Form("Czytnik plików tekstowych");
 
        wyjscie = new Command("Exit", Command.EXIT, 1);
        wstecz = new Command("Wstecz", 2, 2);
        dalej = new Command("Dalej", 1, 4);
        
        
        form.addCommand(wyjscie);
        form.setCommandListener(this);
 
        try {
            readFile("1.txt");
        } catch (IOException ex) {
        }
    }
 
    private void readFile(String filename) throws IOException 
    {
        
          if(!filename.startsWith("/"))
            filename = "/" + filename;
        if(!filename.endsWith(".txt"))
            filename = filename + ".txt";
        
        InputStreamReader reader = new InputStreamReader(
            getClass().getResourceAsStream(filename));
        
       // String line = null;
        String line = null;
        String linia_separator = "-";
        
      
          Object  obj; 
           obj = null;
         
        // Wczytaj pojedynczą linię (null to EOF)
        while ((line = readLine(reader)) != null) {
            // Wyświetl odczytaną linię
   
             if(line.startsWith("MENU:"))
              
        {
            
            List list = null;
            (list = new List(s1.substring("MENU:".length()), 3)).setCommandListener(this);
            String s2 = null;
            do
             //   if((s2 = a1.a()) != null && s2.startsWith("LINK:"))
                {
                    String s4;
                    int j = (s4 = s2.substring("LINK:".length())).indexOf(';');
                    int k = s4.indexOf(';', j + 1);
                    String s8 = s4.substring(0, j);
                    String s9 = s4.substring(j + 1, k);
                    String s11 = s4.substring(k + 1);
                    Image image = null;
                    if(s8 != null && s8.trim().length() > 0)
                        try
                        {
                       //     image = Image.createImage("/" + s8);
                        }
                        catch(Exception _ex) { }
                    int j1 = list.append(s9, image);
                  //  Hashtable hashtable = null;
                    
                }
            while(line != null);
            obj = list;
        }  
               
        if(line.startsWith("Text:"))
                        {
        String s6;
        if((s6 = line.substring("Text:".length())).charAt(0) == '-')
          {
          }
        form.append(line.substring("Text:".length()) + "\n" );
       
        if(s6.charAt(0) == '-')
          {
          }
     
               }
       else
         if(line.startsWith("IMAGE:"))
         {
        form.append(new ImageItem(null, Image.createImage("title.png" + line.substring("IMAGE:".length())), 515, null));
         }
         else
                        if(line.startsWith("FURTHER:"))
                        {
                            String s7 = line.substring("FURTHER:".length()).trim();
                            
                            form.addCommand(wstecz);
                            form.setCommandListener(this);
                        } else
                        if(line.startsWith("SEPARATOR:"))
         
                            System.getProperty("linia_separator.SEPARATOR:");

                            
                           }

        reader.close();
    }
    
     public final void itemStateChanged(Item item)
    {
        Enumeration enumeration = c.keys();
        do
        {
            if(!enumeration.hasMoreElements())
                break;
            Object aobj[] = (Object[])enumeration.nextElement();
            if(item == aobj[0])
            {
                ChoiceGroup choicegroup = (ChoiceGroup)item;
                int i = ((Integer)aobj[1]).intValue();
                if(choicegroup.getSelectedIndex() == i)
                {
                    String s = (String)c.get(((Object) (aobj)));
                    
                }
            }
        } while(true);
        return;
       
    }
 
    private String readLine(InputStreamReader reader) throws IOException {
        int readChar = reader.read();
        if (readChar == -1) {
        return null;
        }
        StringBuffer string = new StringBuffer("");
        // Czytaj dopóki nie trafisz na koniec pliku lub nową linię
        while (readChar != -1 && readChar != '\n') {
            if (readChar != '\r') {
                string.append((char)readChar);
            }
            // Czytaj kolejny znak
            readChar = reader.read();
        }
        return string.toString();
    }
 
    public void startApp()
   {
         Display.getDisplay(this).setCurrent(form);
         
    }
 
    public void pauseApp() {
    }
 
    public void destroyApp(boolean unconditional) {
    }
 
    public void commandAction(Command command, Displayable displayable) 
    {
        if (command == wyjscie)
        {
            notifyDestroyed();
        }
         if (command == wstecz) 
        {
            {
            if(displayable instanceof Form)
            {
                Form form = (Form)displayable;
                boolean flag = false;
                int i = 0;
                do
                {
                    if(i >= form.size())
                        break;
                    Item item;
                    if((item = form.get(i)) instanceof ChoiceGroup)
                    {
                 
                        flag = true;
                        break;
                    }
                    i++;
                } while(true);
               
                return;
            }
        }
            }
         if  (command == dalej) 
        {
            notifyDestroyed();
        }     
    
}
}

dziękuje za odpowiedz