• 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

package javax.servlet does not exist

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 please let me no. and in details if you please
My jdk directory is C:\Program Files\Java\jdk1.6.0
 
Marshal
Posts: 67418
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this concerns Netbeans, it's been moved to the IDEs forum.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

but i get JAVAC NOT RECOGNIZED


This means that you did not add %JAVA_HOME%\bin to the PATH.

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


You need to add the servlet JAR file to your project. (I'd provide more details but I haven't used Tomcat 4.1 in years and names of JAR files tend to change from release to release; and I use Eclipse rather than NetBeans.)
 
Leo Max
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i ended up with javahome pointing to jdk and path pionting to its bin. i put them both in user and sys vars. so im done.
im working on a mobile application so installed the wireless toolkit 2.5.2 from sun. http://www.roseindia.net/j2me/index.shtml has a lot of code that i can use for my app. i just need to understand the code so that i can add the bits i need. if i have questions about this, where can i post these questions?

thnx for the help btw!
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post questions about the mobile apps in https://coderanch.com/forums/f-41/Java-Micro-Edition.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic