0

I am writing a java application on mobile which uses Bluetooth connections
The javac compiler compiles the file without error but when I try to exe a certain part of the code it says:
ALERT:Cannot create class in system package
and this doesnot happen in application beginning it happens at a certain point when I call a function from the Class Thread during execution...
I am using midp2.0 and use the command line to execute...I defined the environment variables correctly...
The Code is:

package doctor;
import java.io.*;
import java.lang.*;
import java.util.*;
import javax.bluetooth.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Program extends MIDlet implements CommandListener
{
private Display display;
private TextBox textBox1;
private Command entryCommand;
private Command exitCommand;
public void startApp()
{display=Display.getDisplay(this);
 entryCommand=new Command("OK", Command.SCREEN, 1);
 exitCommand=new Command("Quit", Command.SCREEN, 1);
 textBox1=new TextBox("How application works..", "This application helps to send an alert to the doctor to let him informed with his patient 's heart condition. It also allows the patient to monitor his heart illness and danger moments and how often does it happen.", 256, 0);
 textBox1.addCommand(entryCommand);
 textBox1.addCommand(exitCommand);
 textBox1.setCommandListener(this);
 display.setCurrent(textBox1);
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command choice,Displayable displayable)
{if(choice==exitCommand)
 {destroyApp(false);
  notifyDestroyed();
 }
 else
 { 
            try {
                BLUE();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
       }

       }
public void BLUE() throws IOException
{ 
   UUID serviceUUID = new UUID(0x0003L);
   String serviceURL = "btspp://localhost:" + serviceUUID.toString() + ";name=com.example";
   StreamConnection con= null;
   StreamConnectionNotifier service= null;
   InputStream ip= null;
   OutputStream op=null;
    service=(StreamConnectionNotifier)Connector.open(serviceURL);
    con=service.acceptAndOpen();
    ip=con.openInputStream();
    op=con.openOutputStream();
      ReadThread rdthr=new ReadThread(ip,op);
      rdthr.start();
}
 class ReadThread extends Thread implements Runnable
{InputStream ip=null;OutputStream op=null;
 public ReadThread (InputStream inp,OutputStream onp){ip=inp;op=onp;}
 public void run()
 {
  try{char data;
      data=(char)ip.read();
      op.write(data);
     }
  catch(IOException e){}
 }
}

}

Note that I tried to get the Class Thread out of the Class Program but same error persists...May be defining 2 classes in one MIDlet is the error ...I donot know

Thanks for help

Edited by johnnydarten: n/a

1
Contributor
2
Replies
3
Views
7 Years
Discussion Span
Last Post by johnnydarten
0

If This is the wrong section Please MODERATORS move the thread to the right section

0

It is 174 viewed the problem and no one answered???!!!
Does this mean it is too hard or too easy???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.