Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2004

    problems to run simple java application


    I've some problemlos to run my simple java application on my Nokia 6630 mobile phone.

    I created the following application:
    --- Begin Code test.java ---
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;

    public class test extends MIDlet implements CommandListener {
    private Display display;
    private Form form;
    private TextField world;
    private Command cmdClose;

    public test() {
    display = Display.getDisplay(this);
    form = new Form("Test Program");
    world = new TextField("Field: ", "Hello World!", 3, TextField.ANY);
    cmdClose = new Command("Close", Command.EXIT, 1);

    public void startApp() throws MIDletStateChangeException {

    public void pauseApp() {

    public void destroyApp(boolean flag) {

    public void commandAction(Command command, Displayable displayable) {
    --- End Code ---

    Then I created the following manifest file:
    --- Begin Code MANIFEST.MF ---
    Manifest-Version: 1.0
    MIDlet-Name: Test Program
    MIDlet-1: test
    MIDlet-Version: 1.0
    MIDlet-Vendor: Kay
    Created-By: 1.3.0 (Sun Microsystems Inc.)
    MicroEdition-Configuration: CLDC-1.0
    MicroEdition-Profile: MIDP-1.0

    --- End Code ---

    I compiled this source code and packed the compiled .class file with the following commands:
    javac -classpath C:\Programme\WTK104\lib\midpapi.zip test.java
    jar cvfm test.jar MANIFEST.MF test.class
    The test.class and the test.jar files were created without any errors.

    Then I copied the test.jar file via USB-Cable (Nokia PC Suite software) to the install directory of my mobile phone. I selected the received file on my phone and opened it - the install process was started. After the successful installation, a new program icon was placed in the phone menu.

    If I start the test program now, nothing happens. The program doesn't run (the program window isn't shown) and there are no error messages. Only the phone menu is shown again.

    Where is the error? What I did wrong?


  2. #2
    Registered User
    Join Date
    Mar 2003

    Re: problems to run simple java application

    javac -bootclasspath C:\Programme\WTK104\lib\midpapi.zip -classpath C:\Programme\WTK104\lib\midpapi.zip -target 1.1 test.java

    Put in JAD:
    MIDlet-Jar-URL: test.jar
    ... or leave it, if 6630 is a Series 60 device (then you don't need a JAD for testing purposes)

    Maybe it works then. Maybe there are other errors...



  3. #3
    Registered User
    Join Date
    Feb 2004

    Re: problems to run simple java application

    I'm kind of new to MIDP
    I try to compile this script using the commands but i don't have the MIDPAPI.zip file, can anyone tell me where i can get this?

    Thanks in advance.

  4. #4
    Regular Contributor
    Join Date
    Jan 2004

    Re: problems to run simple java application

    You should have it because you said so:
    I compiled this source code and packed the compiled .class file with the following commands:
    javac -classpath C:\Programme\WTK104\lib\midpapi.zip test.java
    jar cvfm test.jar MANIFEST.MF test.class
    I have WTK2.2 and for me the MIDP-Api is a .jar package (midpapi10.jar). Maybe you should check you WTK installation for the lib folder and look up the exact spelling of the api.
    And you need the cldc-api (mabe its name is cldc.zip?)

    And you missed a step - the preverifying!
    After compiling with javac you have to preverify the generated class files.
    1) javac -bootclasspath C:\Programme\WTK104\lib\midpapi.zip;C:\Programme\WTK104\lib\cldc.zip test.java
    2) preverify -classpath C:\Programme\WTK104\lib\midpapi.zip;C:\Programme\WTK104\lib\cldc.zip test.class
    3) jar cfm test.jar MANIFEST.MF test.class

    As far as I know the line in the manifest starting with MIDlet-1 misses some information. It has to be like:
    MIDlet-1: test,,test
    (MIDlet-1: SomeName, OptionalIcon, TheMidletClass)
    SomeName: a Name free to choose for you app
    OptionalIcon: a Image(Icon) that is displayed in your phone when you are selecting a java app to start (just add the image to your jarfile)
    TheMidlerClass: the phone needs to know where to start executing - thats the MIDlet derived class (for you "test")

    And an other hint: Go to your WTK installation and find the doc (or docs) folder, there you can find a userguide for the wtk. The commandline reference is on the bottom of the document.

Similar Threads

  1. Java Application Provisioning ove BT
    By a_n_k_u_r in forum Bluetooth Technology
    Replies: 3
    Last Post: 2006-06-23, 08:48
  2. Replies: 3
    Last Post: 2004-02-19, 21:24
  3. Replies: 3
    Last Post: 2003-10-30, 20:49
  4. cant run application in diferent emulators
    By rebeljack in forum Mobile Java General
    Replies: 4
    Last Post: 2003-09-12, 00:09
  5. Replies: 0
    Last Post: 2003-06-11, 07:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts