you've read it once you've read it a thousand times! probably responded to it just as many times. Now i ask that you respond one more time
I've added as many details as possible becuase i've tried the solutions in an old thread in this forum but no luck.

http://developers.sun.com/mobility/midp/articles/tutorial2/ <= I'm following what they're telling me to do step by step but i get JAVAC NOT RECOGNIZED when i try to compile the code from that website. It's called Writing Servlet Source Code

1- I downloaded TOMACAT zip and unzipped it in my C drive => C:\jakarta-tomacat-4.1.31 Contents of hte zip are inside this directory.

2- I went here C:\jakarta-tomacat-4.1.31\webapps\midp\WEB-INF\classes and put a copy of that java file here. I created the directory midp and its subdirectories.

3- I went to C:\jakarta-tomacat-4.1.31\bin and pressed STARTUP. Now the server is running.

4- I started a prompt and did as I was told where i set the path then i tried JAVAC and i failed.

5- I went to ENV vars. There was no classpath. So i created one and added its value as C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

6- I closed the prompt and the server then tried again. Failed.

7- I tried going to the directory where my java file was and then tried javac and still i failed.

8- I started NetBeans and checked plugins. To my luck, and surprise, i found tomacat plugin which I installed alongside another plugin called WebSomething. It says that this plugin will be installed as well since its dependant on it.

9- I went to TOOLS then OPTIONS then MISCLANEOUS and pressed ADD JAR/ZIP next CLASSPATH and put this C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

10- I started a new prj and created a java file with the same name as the one in the site. I copied hte code too. Red lines appeared on almost every line of code. Like import javax.servlet.http.*; was underlined and the tip said package javax.servlet does not exist


So what now? I tried to make my post as detailed as possible. If you have a solution plz let me no. and in details if you plz :D
My jdk directory is C:\Program Files\Java\jdk1.6.0

Recommended Answers

All 6 Replies

5- I went to ENV vars. There was no classpath. So i created one and added its value as C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

Classpath should to be starting with dot, semi-column and then with location of the library; and each new library should be separated from previous library by semi-column .;C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

7- I tried going to the directory where my java file was and then tried javac and still i failed.

It wouldn't compile as classpath is set wrongly

8- I started NetBeans and checked plugins. To my luck, and surprise, i found tomacat plugin which I installed alongside another plugin called WebSomething. It says that this plugin will be installed as well since its dependant on it.

If you install you better to note what it is for future references

9- I went to TOOLS then OPTIONS then MISCLANEOUS and pressed ADD JAR/ZIP next CLASSPATH and put this C:\jakarta-tomacat-4.1.31\common\lib\servlet.jar

Doing the same as you did only thing I can see is option to add Classpath for Ant which will not help you again

10- I started a new prj and created a java file with the same name as the one in the site. I copied hte code too. Red lines appeared on almost every line of code. Like import javax.servlet.http.*; was underlined and the tip said package javax.servlet does not exist

To add project depended libraries you need to right click on the project and select Properties (alternatively File >> Project Properties). On the newly opened pop-up window from Category select Build >> Libraries and Resources and from right hand side select what you need to add to your project.


Command to compile file with given location of pre-required libraries is as follows (Please edit path to servlet-api.jar depending on the home directory of Tomcat - place where you install it)

javac -classpath .;C:\Program Files\Apache Software Foundation\Tomcat6.0\lib\servlet-api.jar MyServlet.java

PS: You should also consider using latest Tomcat no point to stay on old version, even though tutorial is based on it

hey peter thanx for the help. I ended up with two env variables. javahome pointing to jdk and path pointing to its pin. i put both in sys and user vars. i completed the tutorial. now i can start working on my application.
question: i installed Wireless Toolkit 2.5.2 from sun. im trying to write a mobile application that manages pictures. so it displays and sorts them. when im done i wana try to make it so that the pics are in the webserver (tomcat should b enough right?) and the app will get the pics, display them, and sort through
Is there a section that i can ask questions regarding j2me? for example, this site http://www.roseindia.net/j2me/index.shtml has a lot of code that i can use for my app. all i need to do is learn it and understand it. then i can put the bits i need together and vioala! mobile app completed! but ifi have prbs, do i post here or in another section?

thnx for the help

We do not have special mobile section and as JME(J2ME) is just cut-down version of JSE you should post it here.
Also I would recommend to avoid roseindia as they have outdated examples, bad programming habits, plus other things I personally dislike about the site. If you want to learn get either Beginning J2ME: From Novice to Professional or Kicking Butt with MIDP and MSA: Creating Great Mobile Applications which provide excellent and structured way to learn Java mobile development

woo that bad eh? Very well then. It'll take 2-3 weeks until these books arrive to my door step.
Two questions:
1- Back at the university when we started with programming languages we got these books for c++ and java. Big thick ones and they had all sorts of code. They were divided into chapters and each had exercises at the end of the chapter. Like a regular book you get in class. So are these books the same?
2- Until these books arrive, is there no website that you favor thts like the one i mentioned earlier? Something to keep me busy so that I'd RESUME my work instead of start from scratch when the books arrive

Thank You.

Just order one of them, they are written by same author. I posted both of them as some people like to go for top-notch of latest in technology and other are happy to reach for previous now cheaper version. You can have preview of Beginning J2ME from Google Books , for Kicking Butt there is no preview but you can download some of the book code samples.

As for online resources Sun website has list for mobile development here and maybe mobile development with NetBeans (but try to stay away from visual development as this will make you dependent on tool, plus some of the tutorials are made for older version so may posses some troubles to get them running)

Im getting them both. I took a look the website. First glance = A bit intimidating. Big words. Some of which I'll be using at a later time in my project.
I kept scrolling down until i got to GETTING STARTED. I kept going from one link to the other until somehow I ended up back where I started. I think that I covered everything already in GETTING STARTED. It's basically the two tutorials i posted in previous posts and a lot of reading. I don't favor reading much. I'd rather see code and figure out how it all works together. Which is why I liked that rose site i mentioned. Tho outdated, it gives me SOME idea of how I can put a form together. I have a lot of time to experiment AND do some reading.
I already made the order for both books. So until these books arrive, I'll read some more and see which section am I going to start with. I ONLY HOPE THAT the books i ordered have a lot of code and comments. http://developers.sun.com/mobility/midp/articles/s2dvg/index.html <= im skimming thru it and .. there's so much reading! Still i shall prevail

Thanx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.