File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes How to run midlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "How to run midlet?" Watch "How to run midlet?" New topic
Author

How to run midlet?

jyothi sanka
Ranch Hand

Joined: Aug 27, 2001
Posts: 39
I passed java2 Exam.I want to learn J2ME.
I downloaded J2ME wireless Toolkit from sun.I wrote a midlet which name is HelloWorld.java.When I compile I am getting this type of error message(E:\mid\chapter3\HelloWorld.java:4: package javax.microedition.lcdui does not exist
import javax.microedition.lcdui.*
Can anybody explain how to compile midlet?
thanks
Jyothi
chakri ch
Greenhorn

Joined: Mar 27, 2001
Posts: 9
Required classes are not in the classpath. Even though you have downloaded the J2ME toolkit you might have not included the path where classes exist in the classpath.
You got to include them like ../..midp-fcs/classes.
http://www.onjava.com/pub/a/onjava/2001/03/22/j2me_wireless.html Here is a article which give step by step process (right from downloading and appending the system path and classpath) of running a MIDlet
Hope this might help you. If not let me know. I will give you detailed step by step explination.
good luck
chakri
jyothi sanka
Ranch Hand

Joined: Aug 27, 2001
Posts: 39
Hi chakri,
I installed jdk1.3,and j2me in G directory.I want to run midlet.
First I gave this command
(G:\set SUNJ2MEHOME=G:\J2MEWTK)
afterwards I gave this command
(g:\>g:\jdk1.3\bin\javac -g:none -bootclasspath %SUNJ2MEHOME%\lib\kvem.jar HelloWorld.java)
then I am getting this message
"Fatal error unable to locate package java.lang in classpath or bootclasspath"
Can you explain me why i am getting this error message?
And one more thing I saved my helloWorld.java file in jdk1.3\bin directory.I don't know where I hava to save those java files.
thanks for your cooperation
Jyothi
chakri ch
Greenhorn

Joined: Mar 27, 2001
Posts: 9
What is your OS ? Is it Windows NT/2000 ?
Assuming that you are using windows I will answer the question.
First the problem you are having with your existing setup is
1. U got to add G:\J2MEWTK\bin; to you System path in the environment variables.
2.when you give -bootclasspath option for the compiler you mean to say that ignore the default classpath and just consider the path and the class files you mention in the bootclasspath. And if u open that kvem.jar file you can see that it doesn't have java.lang package. So, the compiler couldn't find java.lang package.
3. Having a your class files in jdk/bin directory is not suggested. So, create your own new folder in G drive say for example "jyothi" and include current directory (".") in your CLASSPATH. If you want to override the system CLASSPATH. You got include "." in the bootclasspath too.
Now coming back to how to get it work:
I would suggest you to first run the existing example before you run the sample MIDlet that you wrote, just to fix the problem of configuration and setup errors.
There are many ways to get that working, I will write on of it here.
download MIDP profile http://java.sun.com/products/midp/ and click on a Reference implementation.
create a new folder called j2ME on G drive and save it into g:/j2ME folder. Unzip them into the same folder.
set the CLASSAPATH=G:\j2ME\midp-fcs\classes;. ("." to include current directory as explained before)
add to the System PATH G:\j2ME\midp-fcs\bin
If you look into the classes of midp-fcs you will find all the classes required to compile your file Helloworld.java.
So, now your good to go and run your example Helloworld.java from joythi folder by
calling
javac -bootclasspath g:\j2ME\midp-fcs\classes Helloworld.java
Let me know if you still come across problem running it.
good luck
-chakri

Originally posted by jyothi sanka:
Hi chakri,
I installed jdk1.3,and j2me in G directory.I want to run midlet.
First I gave this command
(G:\set SUNJ2MEHOME=G:\J2MEWTK)
afterwards I gave this command
(g:\>g:\jdk1.3\bin\javac -g:none -bootclasspath %SUNJ2MEHOME%\lib\kvem.jar HelloWorld.java)
then I am getting this message
"Fatal error unable to locate package java.lang in classpath or bootclasspath"
Can you explain me why i am getting this error message?
And one more thing I saved my helloWorld.java file in jdk1.3\bin directory.I don't know where I hava to save those java files.
thanks for your cooperation
Jyothi

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run midlet?