This week's book giveaway is in the General Computing forum.
We're giving away four copies of Emmy in the Key of Code and have Aimee Lucido on-line!
See this thread for details.
Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

simple code not working from tutorial

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there...

post your CLASSPATH and PATH variables...
 
Anjanesh Lekshminarayanan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to point the classpath to the .jar files, not the directory where the .jar files are located in.
 
Anjanesh Lekshminarayanan
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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".
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 love a good mentalist. And so does this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!