This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes simple code not working from tutorial Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "simple code not working from tutorial" Watch "simple code not working from tutorial" New topic
Author

simple code not working from tutorial

Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
Hi
I'm trying to learn j2me and found this nice tutorial (http://www.zindell.com/israeliJavaBookME/ch1.htm) from this forum but it was written in 2001.
There is this simple code :

The tutorial gave this commandline :
javac -bootclasspath c:\j2mewtk\lib\midpapi.zip HelloIsrael.java
but obviously this was in version 1. I have version 2 and so I gave this :
javac -bootclasspath c:\WTK21\lib\midpapi10.jar HelloIsrael.java
I also tried midpapi20.jar but both tries gave these 2 errors:

HelloIsrael.java:3: cannot access java.lang.Object
file java\lang\Object.class not found
public class HelloIsrael extends MIDlet
^
HelloIsrael.java:10: cannot resolve symbol
symbol : variable this
location: class HelloIsrael
display = Display.getDisplay(this);
^
2 errors

Can anyone help me out here ? I am running form bin directory.
Thanks


Anjanesh Lekshminarayanan
Arnab Sen
Greenhorn

Joined: Dec 25, 2003
Posts: 20
hi there...

post your CLASSPATH and PATH variables...
Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
When I tyed path it gave. i know java is not listed but I normally run my java files from the bin folder directly.
PATH=C:\WINDOWS\system32;C:\WINDOWS;

Otherwise how else do I retrieve classpath & path ?

Java is in C:\j2sdk1.4.1_02\bin and j2me in C:\WTK21
Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
I did this :
javac -bootclasspath c:\wtk21\lib\midpapi20.jar,C:\WTK21\lib\cldcapi11.jar -classpath C:\Progra~1\Java\j2re1.4.2_04\lib HelloIsrael.java

Changed classpath to this too : classpath C:\j2sdk\lib

I am getting this always :
Fatal Error: Unable to locate package java.lang in classpath or bootclasspat
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
You need to point the classpath to the .jar files, not the directory where the .jar files are located in.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
Which jar file(s) are you talking abt ? The one with J2ME or J2SE ? Also which one is the one that contains java.lang.io ?
Thanks
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Anjanesh Lekshminarayanan:
Which jar file(s) are you talking abt ? The one with J2ME or J2SE ? Also which one is the one that contains java.lang.io ?
Thanks

Both.

java.lang.* and java.io.* are part of J2SE's "tools.jar".
Rashi Gulati
Ranch Hand

Joined: Jan 08, 2004
Posts: 44
Dear Anjanesh

It would be better if you use j2me wireless toolkit, then atleast you save yourself from running the application from command prompt, it will take care of your classpath as well. If you need the url to download the kit i will post the url.

Regards
Rashi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: simple code not working from tutorial
 
Similar Threads
Error in Sun One Studio Mobile Edition
Converting MIDP suites to .PRC files
Compile
Please help!
cannot resolve symbol