Reputation: 930
I currently have Java ME SDK 3.0.5 installed and am running a MIDLET from Eclipse.
When I run the app under the emulator device I get the following data in the console:
Syntax:
emulator [arguments]
In order to get commands supported by given device run:
emulator.exe -Xdevice:<device name> -Xquery
Generic list of arguments is:
-version Display version information about the emulator
-help Display list of valid arguments
-classpath, -cp The class path for the VM
-D<name>=<value> Set a system property
-Xdebug Use a remote debugger
-Xrunjdwp:[transport=<transport>,address=<address>,server=<y/n>,
suspend=<y/n>]
Debugging options
-Xdevice:<device> Select a device skin for the emulator
-Xdomain:<domain_name>
Set the MIDlet suite's security domain
-Xmain:<main class name>
Run the main method of a Java class, as in Java SE
-Xquery Print device information
Everything seems to be alright, but I can't get any form of emulation to appear.
here is the code of my MIDLET, although I don't think the problem lies here.
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
public class Hello extends MIDlet implements CommandListener {
private Command exitCommand;
private Display display;
private Form screen;
public Hello() {
display = Display.getDisplay(this);
exitCommand = new Command ("Exit", Command.EXIT, 2);
screen = new Form ("Hello World");
StringItem strItem = new StringItem ("","Hello World");
screen.append (strItem);
screen.addCommand (exitCommand);
screen.setCommandListener(this);
}
public void startApp() throws MIDletStateChangeException {
// set the current display to the screen
display.setCurrent(screen);
}
public void pauseApp() {
// TODO Auto-generated method stub
}
public void destroyApp(boolean unconditional) {
// TODO Auto-generated method stub
}
public void commandAction (Command c, Displayable s)
{
if (c == exitCommand)
{
destroyApp (false);
notifyDestroyed();
}
}
}
Upvotes: 1
Views: 2382
Reputation: 101
Here is post how to run jar from emulator (Java ME SDK 3.0.5)
(How to run MIDLET in Java ME SDK 3.0.5 ::http://madhukaudantha.blogspot.com/2012/10/how-to-run-midlet-in-java-me-sdk-305.html
Upvotes: 0
Reputation: 173
I had a similar problem while running a basic JavaMe app on eclipse, "Corrupt JAR, error while reading". It worked for me after I followed this series for starters http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.mtj.doc.user/html/gettingstarted/prepare_workbench.html (try not to miss anything mentioned here).
Note, when you launch the app, use "Launch as emulated Java ME JAD"(-in the top right "Running" section on the page) from the "Application descriptor" (-from left menu.)
This is a late reply but might just help someone in future.
Upvotes: 1
Reputation: 1266
If you are adventurous and want to develop / run JavaME application without IDE's than I have some ray of hope, write a batch script (or shell script for linux system) to manually run the emulator with specific jad
Batch Script (run.bat)
"<javame-3.0-sdk-root-folder>\bin\emulator.exe"
-Xdescriptor:"<jad-filename-with-extension>" >> logs.txt
pause
exit
save the above script in the same folder as the application jad/jar. The console prints will be available in log.txt
file.
Upvotes: 0
Reputation: 930
I switched over to Netbeans, which has integrated support for J2ME (as opposed to having to install a 3rd party plugin for Eclipse) and it now works perfectly.
Upvotes: 1
Reputation: 7448
The output is pretty simple, it's telling you that the command line syntax to the emulator is incorrect.
Go to the Java ME device settings and edit the emulator command line / start options to suit.
Switching IDE's may work for you as a short-term fix, but it's always better to get to the root of the issue. Plus it'll help you understand the emulator framework.
Upvotes: 3