• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to run midlet?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic