Running MIDlet on PC?

Hi. I'm pretty new to Java ME, so excuse me if this question sounds stupid :-). i was searching for answer for several hours, but couldn't find anything.
Is it possible to run MIDlet on PC outside the emulator, ie. using command line like
kvm -classpath ../my/classpath my.package.MyClassThe thing is, i wrote a midlet which works fine in emulator, but I wanted to try running it outside the emulator. When i run the command as above, i get a message like "can not create class in system package".
Also, can anybody explain or provide a link to how to install and run midlet on actual device? Is it enough to only download it and start KVM or are there additional steps required?
Thanks in advance for your answers.

Try to find line where execution stops.
PrintOnScreen.print("line 100");
anyFunc();
PrintOnScreen.print("line 102");
May be anyFunc() is synchronized, somewhat inside anyFunc() is syncronized or function waits for something.
Does readUTF play role of anyFunc in your case?
Try using flush() (when writing)
check what result available() returns
(Returns the number of bytes that can be read from this input stream without blocking.)
Message was edited by:
learnphysics
Message was edited by:
learnphysics

Similar Messages

  • Need to run midlet from another midlet

    Need to run midlet from another midlet
    How to do it?
    In my midlet user get link to web-page, and i want to start mobile browser with this page.

    Hi,
    In order to run midlet from another midlet you may use push registry. Go through the API of that I am not sure but as far as I know push registry is the only solution to that
    Sunil
    Software Developer - J2ME

  • Executing a downloaded midlet out of the running midlet, possible?

    hi,
    I want to create a midlet that
    - connects to a server (over http) [found lots of tutorials for this case]
    - there the user can choose from a list of midlets
    - than download a midlet (the jar archiv and the jad file)
    - this downloaded midlet should be saved anywhere on the mobile device
    - and should be executed.
    Is this possible?
    Can I start a midlet out of another midlet (which is for example stored over the RMS)?
    Furthermore is it possible to start any other application out of an running midlet (for example I want to play a downloaded flash file [my device supports flash])?
    I'm using the motorola a920, which supports MIDP 1.0 und CLDC 1.0.
    thx
    matt

    In MIDP 1.0 that isn't possible. But I recall the A920 being a MIDP 2.0 device, in which case there's a method that might be able to do that called platformRequest(). The spec is very general about it, so it's capabilities vary from phone to phone (the only thing required of this method is to display a URL in a browser, but it could be used for a bunch of other things). I don't know what are the capabilities on the A920.
    On the other hand, Motorola handsets usually have a lot of extension APIs, so maybe that's also something to look at.
    shmoove

  • Error in running MIDlet

    Hi, all
    I have a problem around MIDlet.
    Here, the MIDlet source code :
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    import javax.microedition.io.*;
    import java.io.*;
    public class BolaMidlet extends Form implements CommandListener
    +{     +
    private Display display;
    private static final Command cmExit = new Command("Keluar", Command.EXIT, 1);
    private static final Command cmSubmit = new Command("Login", Command.OK, 1);
    private BolaMidlet midlet;
    private TextField tfUsername;
    private TextField tfMajor;
    private String result;
    public BolaMidlet(BolaMidlet midlet, Display display)
    +{+
    super("BolaMidlet");
    this.midlet = midlet;
    this.display = display;
    tfUsername = new TextField("Username", "", 20, TextField.ANY);
    tfMajor = new TextField("Major", "", 20, TextField.ANY);
    append(tfUsername);
    append(tfMajor);
    addCommand(cmExit);
    addCommand(cmSubmit);
    setCommandListener(this);
    +}+
    public void startApp()
    +{+
    display.setCurrent(this);
    +}+
    public void pauseApp()
    +{+
    display.setCurrent(null);
    +}+
    public void destroyApp(boolean unconditional)
    +{+
    +}+
    public void exitMIDlet()
    +{+
    destroyApp(false);          
    +}     +
    public void commandAction(Command c, Displayable s)
    +{+
    if(c == cmExit)
    +{+
    midlet.exitMIDlet();
    +}+
    else if(c == cmSubmit)
    +{+
    try
    +{+
    submit(tfUsername.getString(), tfMajor.getString());
    +}catch(Exception e)+
    +{+
    e.printStackTrace();
    +}+
    +}          +
    +}+
    public void submit(String user, String major)
    throws IOException
    +{+
    String url = "http://localhost:8080/hello/sayhello?user=user&pass=major";
    HttpConnection hc = null;
    StringBuffer sb = null;
    InputStream is = null;
    try
    +{+
    hc = (HttpConnection)Connector.open(url, Connector.READ_WRITE);
    hc.setRequestMethod(HttpConnection.GET);
    hc.setRequestProperty("User-Agent", "Profile/MIDP-2.1 Configuration/CLDC-1.1");
    hc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    if(hc.getResponseCode() == HttpConnection.HTTP_OK)
    +{+
    sb = new StringBuffer();
    int ch;
    is = hc.openInputStream();
    while((ch = is.read()) != -1)
    sb.append((char)ch);
    +}+
    else
    +{+
    System.out.println("Network error");
    +}     +
    +}catch(IOException e)+
    +{+
    e.printStackTrace();
    if(hc != null)
    hc.close();
    if(sb != null)
    result = sb.toString();
    if(is != null)
    is.close();
    +}finally+
    +{+
    if(is != null)                    
    is.close();                    
    if(sb != null)               
    result = sb.toString();                    
    if(hc != null)                    
    hc.close();                    
    +}+
    +}+
    when I compiled it, there was no problem.
    But, when I launched it on the emulator
    there was an error in WTK console like this :
    Unable to create MIDlet BolaMidlet
    java.lang.IllegalAccessException
    at com.sun.midp.midlet.MIDletState.createMIDlet(34)+
    at com.sun.midp.midlet.Selector.run(22)+
    and then the emulator said : BolaMidlet, BolaMidlet exception : java.lang.IllegalAccessException
    can someone help me to solve this ?
    I really need help for this one.
    Thank You,
    Best Regards,
    CHi
    Edited by: ichiwan on Sep 30, 2007 11:23 AM

    {color:#000080}The code you have posted is for a class that extends Form, not MIDlet.
    To post code, use code tags --{color} [code]CODE[/code] {color:#000080}is displayed as CODEPlease do not try to format parts of your code as bold or italic as that reduces the readability still more.
    db{color}

  • Black screen when running MIDlets on a real phone (motorola V330)

    Hello.
    I'm developing a simple Java ME application as a part of my senior project in college. Up until this point I've been working with emulators and everything works fine. Yesterday I tried to upload and test my application on my old phone - Motorola V330 (CLDC 1.0 MIDP 2.0).
    I can upload and install MIDlets without problems. (Using unlocked application loader and a USB cable). When I try to start them, the screen goes black and stays black. If I hit the "exit" softbutton or the red power button, I can see my application for a split second before the program exits. For example if I try to run a game, I see the game screen for a split second, if I try to run a form, I see that form. That tells me that the application can start, but I dont know why I get a black screen.
    I tried that with a bunch of applications, even for a simple form with "hello world" on it, the screen goes black.
    I also tried some games from SUN examples and I have the same problem.
    Anybody can give me any hints on how to solve the problem? Could this be the phone issue or is it some sort of security certificate issue?
    I tried googling the issue and searching these boards but I cant find any concrete solutions.
    PS. The phone is old and is no longer connected to the network, but it still has a sim card.

    Yeah, it's CLDC1.0 and MIDP 2.0.
    I've looked at the phone again and found out that in "Java settings" menu the "backlight" option was turned off by default. Turning it on allows me to see my java apps. So the problem is solved.
    When I had similar problems with my laptop (black screen, barely visible text) it took me a ridiculous amount of time to talk to technicians over the phone and try to explain to them what I'm seeing. Apparently the problem was the same - the backlight on my laptop's display was malfunctioning. I hope this info will help some of you or at least will help you googling stuff if you ever encounter the same problem.

  • How to run MIDlet in background in J2ME?

    Hi Friends,
    I am new guy to J2ME and MotoRazr. I just want to run application in background while other application as normal. I am targeting MotoRazr v3xx, MIDP-2.0 & CLDC-1.0.
    In some post I found that we can use "Backgrounf: True" in JAD file, I tried this but it is not working.
    Can someone will help me?
    Thanks
    From
    [email protected]

    Thanks deep,
    But I really searched in forum .... and now also I am searching. But haven't found any solution.
    I just got some keywords like
    1) pauseApp()
    2) display.setCurrent(null)
    3) PushRegistry
    4) MIDlet without UI
    5) in JAD file "Background: True"
    6) Thread
    Can you tell me which should I use?
    My exactly problem is to Run a process in background which will trap key events while other applications are running.
    What do you do suggest?
    Thanks

  • Runtime Error, when running midlet.

    I can build the midlet without problems. This error occurs when the emultator starts the midlet. I can se the phone for a sec or two then i turns of and the error occurs in the console.
    I am using, j2me, eclipse, eclipseme, cldc1.1,mipd2.2.
    Running with storage root DefaultColorPhone
    java.lang.ClassNotFoundException
         at com.sun.midp.midlet.MIDletState.createMIDlet(+14)
         at com.sun.midp.midlet.Scheduler.schedule(+52)
         at com.sun.midp.main.Main.runLocalClass(+28)
         at com.sun.midp.main.Main.main(+116)
    Execution completed.
    705709 bytecodes executed
    5 thread switches
    739 classes in the system (including system classes)
    3582 dynamic objects allocated (97424 bytes)
    1 garbage collections (0 bytes collected)
    I am not sure about whats wrong. Isn't is supposed to be a class name the exception. like this.
    java.lang.ClassNotFoundException. xxxxxxxxxxxxx
    So i know in what class the exception occurs.??
    Anyhow, anyone that has any clue what could be wrong?
    Seems to be an error with the emulator not with the build priocess.
    I get the same error while triyng to run it with ktoolbar.
    thnx

    I can assure of one thing.. there is no such message anywhere
    in the
    product. You should get the actual message from your user and
    let us know
    what it is.
    Mike
    ====================
    Mike Baker
    Adobe Community Expert
    mike-baker at cox dot net
    "webacity" <[email protected]> wrote in
    message
    news:gfuorj$ebe$[email protected]..
    > Hi
    >
    > One of our users has reported to a error when running an
    authorware
    > session in
    > Vista:
    >
    > "I get the message when trying to open the session...
    >
    > It says:
    >
    > Authorware runtime does not work anymore.."
    >
    > Any ideas why this user is getting this problem?
    >
    > thanks
    > Jon
    >

  • Run midlet from command prompt

    Hi all,
    Can someone please detail me, as to how can I run the midlet from the command prompt directly and whether all kind of midlets (including those which use bluetooth and WMA api's ) can be directly run from the command prompt in windows. Any documentaiton or weblink to this will be appreciated.
    TIA
    -Shishir

    I have got around the issue. Previously I had not mentioned the path initially. But now I am getting an ExceptionInitializerError
    Here is the command again
    C:\Program Files\WTK2.5.1>java -cp .\wtklib\kvem.jar;.\wtklib\kenv.zip;.\wtklib\
    lime.jar;.\apps\Games\bin\Games.jar;.\wtklib -Dkvem.home=. com.sun.kvem.midp.Mai
    n DefaultGrayPhone -descriptor .\apps\Games\bin\Games.jadThe errors are
    Warning: Toolbar resources not found
    java.lang.ExceptionInInitializerError
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce)
            at java.lang.reflect.Constructor.newInstance(Unknown Source)
            at com.sun.kvem.environment.EmulatorInvoker.runEmulatorImpl(Unknown Sour
    ce)
            at com.sun.kvem.environment.EmulatorInvoker.main(Unknown Source)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at com.sun.kvem.environment.JVM.main(Unknown Source)
    Caused by: java.lang.NullPointerException
            at com.sun.kvem.util.ToolkitResources.getString(Unknown Source)
            at com.sun.kvem.midp.MIDP.initMenuActions(Unknown Source)
            at com.sun.kvem.midp.MIDP.<clinit>(Unknown Source)

  • Running midlets on a cell phone

    Hi all
    How do I run my MIDlet on my cell phone? The app works fine on the emulator. I sent the .jar file of my application to my cellphone via IR but my phone keeps displaying it as an invalid app and it doesn't run. Am I doing something wrong?

    Hi !
    now I can specify:
    # 1 - your local folder ------ where you put your .class ( or your packages ) and everything else needed by the midlet ( images ... ) ------ must contain empy folder "META-INF" where the jar construction puts its "MANIFEST.MF" file taken from your original jad file:
    original jad file ( put in a different folder ):
    MIDlet-1: MidletCamera, /res/images/Midlet.png, MainCamera
    MIDlet-Name: MidletCamera
    MIDlet-Vendor: Xxxxxxxxxx
    MIDlet-Version: 1.0
    MicroEdition-Configuration: CLDC-1.1
    MicroEdition-Profile: MIDP-2.0
    MANIFEST.MF file written by program jar in the folder META-INF, so included in the output MidletCamera.jar:
    Manifest-Version: 1.0
    MicroEdition-Configuration: CLDC-1.1
    MIDlet-Name: MidletCamera
    Created-By: 1.4.2_05 (Sun Microsystems Inc.)
    MIDlet-Vendor: Xxxxxxxxxx
    MIDlet-1: MidletCamera, /res/images/Midlet.png, MainCamera
    MIDlet-Version: 1.0
    MicroEdition-Profile: MIDP-2.0
    # 2 - the ( MidletCamera ).jar must be in ( or moved to ) the folder from which you choose ( left panel ) using Nokia PC Suite and that is all PC Suite needs in order to install the midlet on the phone.
    I hope this is clear and that helps solve your problems. Carlo

  • J2ME update gui while running MIDlet

    Hello all,
    I've got a method in my MIDlet which is to show a new form for about 2 seconds and then revert back to the application. It already does all of it's calculations right but it simply does not update the GUI until after the 'return' statement.
    Does anybody know why it does not update the GUI before waiting those two seconds and how could I make it do that? Below is my (greatly oversimplified) code.
         public int Throwing(int diceResult)
                   Form fi = new Form( "Dice" );
                   fi.append("lalala");
                   getDisplay().setCurrent( fi );
              Thread currentThread = Thread.currentThread();
              try {
                   synchronized(this)
                   System.out.println("waiting");
                     wait( 2000 );
                   catch ( InterruptedException ie )
                        System.out.println("Exception caught");
                   System.out.println("Returning");
                 return diceResult;
         }

    What do you mean "the main 'UI' thread continues'. Of course it does. Otherwise your MIDlet becomes unresponsive, as you have seen.
    I imagine what you want is something to be done when Throwing() finishes (like setting a new displayable with the results). In that case you have to make that part of the thread that calls Throwing(). Something like this, maybe:
    public void run() {
      int result = Throwing(5);
      Form f = new Form("Results");
      f.append("The result is " + result);
      getDisplay().setCurrent(f);
    }shmoove

  • Difficulty running MIDlets with  any emulator

    Hello I am trying to run a MIDlet compiled and packaged with the Java Wireless Toolkit 2.3 beta on the emulator and I receive the error....
    Running with storage root DefaultColorPhone
    Error running executable C:\WTK23\bin\zayit
    java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
         at java.net.ServerSocket.createImpl(ServerSocket.java:255)
         at java.net.ServerSocket.getImpl(ServerSocket.java:205)
         at java.net.ServerSocket.bind(ServerSocket.java:319)
         at java.net.ServerSocket.<init>(ServerSocket.java:185)
         at java.net.ServerSocket.<init>(ServerSocket.java:97)
         at com.sun.kvem.Lime
    It is on my Windows XP Home edition with no Internet connection. I'm not sure if that would help.
    I don't feel MIDlet code is a problem being that it does this to any MIDlet I try to run. I thought It was a problem with environment variables but I made some changes based on other forum suggestions and it still doesn't work. Also, any emulator seems to generate the problem. I used Java's versions and a Nokia one.
    Help would be greatly appreciated.

    The extra methods are not needed!
    Tried the following (as suggested) and still no help. This actually is working with appletviewer, however I am still unable to open in internet explorer. And fyi, the .class file IS in the same directory.
    <html>
    <title>Hello World</title>
    <center><h1>Hello World</h1></center>
    <body>
    <applet code="SimpleApplet.class"
    width=500 height=120>
    </applet>
    </body>
    </html>

  • Running MIDlet on pocketPC

    Hi All,
    I've succesfully created and deployed My First MIDlet (http://www.oracle.com/technology/tech/wireless/tools/jwe/j2me_configuration_and_creation_viewlet_swf.html) using the WT104 (for WT22 you need to put in your own Ant file, see http://developers.sun.com/techtopics/mobility/midp/questions/autobuild/ ).
    But now I want to run this from my pocketPC (iPaq hx4700). I assume I need some JVM (and how to start the jar files?). Or maybe ther're some other ways to accomplish this? What step am I missing?
    Any ideas anyone?
    Regard,
    Michiel

    For those who also wondered, I've installed Ibm's J9VM ( http://www14.software.ibm.com/webapp/download/product.jsp?s=p&id=DVDE-634P22 ), copied the .jar and .jad files and just tapped the .jad file and it worked.
    Regards,
    Michiel

  • Running midlet on actual device

    I am just beginning to learn Java WTK. Can anyone give me steps by steps instruction on how to port a midlet (a simple 'Hello World' midlet) fully workable on the emulator onto the actual device? I am using a LG G7100 although I am also interested in Nokia.

    You ever find an answer? I have an LG VX5200 phone which is supposed to support Java. But aside from downloading Java apps from other sites I'm trying to figure out which folder on the phone's filesystem you place the file. With BitPIM and QPST you can view the phone's filesystem. But as yet to find either a folder that works or combination of settings to get it to show up on the phone list of apps.
    I had hoped that maybe someone had downloaded a game from a site and then looked at the phone to see where and how it's stored. I can't from where I'm at.
    Michael

  • Is it possible to run midlets in KVM environment?

    If yes, where could i download kvm?
    Regards, Euclides.

    You should use the J2MEWTK 1.04. This is the emulator that enables you to develop, and test the midlets you are creating.
    (http://java.sun.com/products/j2mewtoolkit/download.html)
    Aurel

  • How can I run MIDlet in my smartphone

    I am a beginner to study coding java programs for smartphone .But I have some questions such as:
    1. How can I know whether my smartphone has MIDP etc.
    2.My phone's OS IS MICROSOFT SMARTPHONE 2003, can you tell me that if there is no MIDP ,where can I get it . and How to install it .
    If I have some errors about concepts,could you please point them out .
    Thanks very much !

    i think Microsoft does not OS's with MIDP installed in them.
    it is a big issue as of today.
    moreover i think on Smartphones, it might not be possible for us to install.
    all this stuff is the manufacturer's headache.

Maybe you are looking for