You Are Here:

Community: Developer Discussion Boards

#1 Old I can't run java application on emulator - 2007-09-14, 07:29

Join Date: Sep 2007
Posts: 8
kempston
Offline
Registered User
Hi,

I compiled sources of helloworldplus demo application with javac 1.4.2_06. I can install it on Emulator but it is impossible to run it. No error is generated - after launch nothing happens.

The original jar of hello application can be loaded and run successfully. The only difference is that in my jar are classes compiled by me, JAD and manifest are the same except jar size parameter in jad.

Does anybody know how to fix it?
Where can I find any log?

I'm using Emulator from S60 3rd SDK for MIDP.

Regards,
kempston
Reply With Quote

#2 Old Re: I can't run java application on emulator - 2007-09-14, 08:07

Join Date: Jun 2007
Posts: 534
Location: Mumbai
Send a message via Yahoo to prakash.raman
prakash.raman's Avatar
prakash.raman
Offline
Super Contributor
well its very difficut to say wat might be cause, so u try to put some system.out in the code and try if the app is starting or not, and in catch block print the excepcetion and see if any comming.
Reply With Quote

#3 Old Re: I can't run java application on emulator - 2007-09-14, 08:47

Join Date: Sep 2007
Posts: 8
kempston
Offline
Registered User
I put try-catch in startApp(), but nothing changed. Application is installable but I cannot run it. No error, no visible effects. In diagnostic tools I can't see HelloWorldPlus process. It seems that launching engine in emulator in some reason doesn't work with my application.

To be completely sure I produced following code and experienced the same:

package ex3;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Class1 extends MIDlet {
public void startApp() {
try {
System.out.println("It's OK!");
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}

Is it possible to switch emulator to generate log with internal events?
Reply With Quote

#4 Old Re: I can't run java application on emulator - 2007-09-14, 09:21

Join Date: Jun 2007
Posts: 534
Location: Mumbai
Send a message via Yahoo to prakash.raman
prakash.raman's Avatar
prakash.raman
Offline
Super Contributor
well buddy i did minor changes in your code and it working fine on wtk tool kit...

Quote:
package ex3;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Class1 extends MIDlet {
public void startApp() {
try {
System.out.println("It's OK!");
} catch (Exception e) {
System.out.println(e);
}
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
}
well wat emulator u using...depending on that u can generate internal logs.... wtk emulator u can enbale logs by setting preferences...
Reply With Quote

#5 Old Re: I can't run java application on emulator - 2007-09-14, 11:49

Join Date: Sep 2007
Posts: 8
kempston
Offline
Registered User
Yes, on WTK it can run.

I installed this application in FP1 emulator and then I've got the same error which was described by mnoromaa in http://discussion.forum.nokia.com/fo...d.php?t=107166
Reply With Quote

#6 Old Re: I can't run java application on emulator - 2007-09-14, 12:30

Join Date: Jun 2007
Posts: 534
Location: Mumbai
Send a message via Yahoo to prakash.raman
prakash.raman's Avatar
prakash.raman
Offline
Super Contributor
Well buddy i tried that code on series 60 3rd edition emulator and it is not working but just try this one if its wokring on ur emulator or not..

Quote:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.*;

public class MIDlet00 extends MIDlet {

TestCanvas testCanvas;

public MIDlet00(){
super();
}
protected void startApp() throws MIDletStateChangeException {
testCanvas = new TestCanvas(this);
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
} // MIDlet

class TestCanvas extends Canvas {
private Display display;
private static int keyCode=0;
private MIDlet midlet;
private final String exitCommandString = "Exit";
public TestCanvas(MIDlet midlet){
this.midlet = midlet;
display = Display.getDisplay(this.midlet);
display.setCurrent(this);
}
public void paint(Graphics g){
g.setColor(0x000000);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0xFFFFFF);
g.drawString(exitCommandString,getWidth()/2,getHeight(),Graphics.HCENTER|Graphics.BOTTOM);
g.drawString("KeyPressed Code: "+keyCode,5,10,Graphics.LEFT|Graphics.TOP);
g.drawString("Screen Size: "+getWidth()+"x"+getHeight(),5,50,Graphics.LEFT|Graphics.TOP);
}
protected void keyPressed(int key){
System.out.println("Key Pressed: "+key);
if(getGameAction(key)==FIRE)
midlet.notifyDestroyed();
keyCode = key;
repaint();
}
}
Reply With Quote

#7 Old Re: I can't run java application on emulator - 2007-09-14, 13:41

Join Date: Sep 2007
Posts: 8
kempston
Offline
Registered User
On S60 3rd MIDP - nothing
On S60 3rd MIDP FP1 - "unhandled exception. application close?"
On WTK it works partly - after launch pressing any key exits the emulator.

In WTK I saw interesting thing. There was an ALERT: java/lang/ClassFormatError:Bad version information

It seems that there is an java version incompatibility among my jar, standard libraries used during compilation, and JVM the emulator run under.
I'll try to make some tests on different versions.
Reply With Quote

#8 Old Re: I can't run java application on emulator - 2007-09-14, 15:51

Join Date: Sep 2007
Posts: 8
kempston
Offline
Registered User
Eureka!

According to http://developers.sun.com/mobility/m...ant/index.html
all class after compilation and before making jar MUST BE preverified.

Preverificator is in bin catalog WTK or Nokia SDK.

Thanks prakash.raman for your attention.
Reply With Quote

#9 Old Re: I can't run java application on emulator - 2007-09-14, 16:00

Join Date: Jun 2007
Posts: 534
Location: Mumbai
Send a message via Yahoo to prakash.raman
prakash.raman's Avatar
prakash.raman
Offline
Super Contributor
Good man u got the solution..
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you run an application on the emulator on the PC so a phone can see it johncogan Mobile Java Networking & Messaging & Security 0 2006-02-21 15:39
My application run perfectly on Emulator but can't run on mobile device (Socket) x1054 Mobile Java Networking & Messaging & Security 5 2005-11-07 22:12
How to run my application in J-Sky emulator bb_sathya Mobile Java Tools & SDKs 0 2005-09-01 09:12
Unable to run application error inside the application prakala Mobile Java General 2 2003-05-27 23:46

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia