• 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

Please Basic Doubt!

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai everybody,
I am new to java servlets .
I have java in c:/jdk1.4.1_02
my class path variables are:
CLASSPATH:c:\j2sdk1.4.1_02\bin\;
JAVA_HOME:c:\j2sdk1.4.1_02\bin
Path:c:\j2sdk1.4.1_02\bin\;
now I downloaded jswdk-1.0.1 for servlets
it was in C:\jsdksevlet\jswdk-1.0.1
I started tomcat server
when I tried to compile HelloWorld.java on the server it is giving error
so how to fix it?
I included in CLASSPATH:C:\jsdksevlet\jswdk-1.0.1\lib
ONE MORE THINK IS I HAVE J2SE IN C DIRECTORY.
PLEASE CLARIFY I AM IN CONFUSION
THANK YOU VERY MUCH HELP WILL BE APPRECIATED
[ October 13, 2003: Message edited by: Mike Curwen ]
 
Ranch Hand
Posts: 541
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this might not solve all your problems but JAVA_HOME should point to your java directory NOT the java/bin directory. PATH should point to the bin directory. CLASSPATH should include the java/lib directory. also tomcat needs CATALINA_HOME to point to where you installed tomcat. im not sure what all that jswdk-1.0.1 is you have and im not sure if you need it, ill let someone else deal with that.
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure how people bypass much newer downloads like this. Or why Sun doesn't put up a huge "STOP" animated gif or something, on those pages.

jswdk-1.0.1 was released in 1999.

Un-install that package and get:
http://java.sun.com/products/jsp/tomcat/
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've just read your post closer. It seems you have tomcat already? Then just uninstall that JSWDK and removing all traces of it from classpath, path, java_home, etc, etc.

Everything you need to compile and run servlets is included with the Tomcat download.

as Tim mentioned,
JAVA_HOME should be c:\jdk1.4.1_02
CATALINA_HOME should be c:\tomcat4.1.27 (or similar)

You can ignore CLASSPATH, as Tomcat does NOT use system classpath.

But to compile your servlets, you'll need to ensure that servlet.jar is on the classpath. I'd recommend getting cozy with ANT, or use the command-line -classpath switch over system CLASSPATH. servlet.jar is included with the Tomcat distribution.
 
ramakrishna pydipati
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I really appreciate your help.Thanks you very much.
one more thing, just now I am reading a book, it says JSDK files has to be in my classpath ,to run servlet, so what I have to do?
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First it was jswdk, now it's jsdk. Which one? The reason I'm being particular is that almost any combination of letters that starts with 'j' has at one time been provided as a download/api/package by Sun.

JSWDK: JavaServer Web Development Kit
JSDK : Java Servlet Development Kit
*Neither* of which is the latest. And I'm not talking just a few months or even a year. You'd have to find these downloads in the archive section of Sun's web site.

What you *need* to do is stop reading that book. If it talks about the newest technology, but makes mistakes like referring to it as a jsdk, then it's not a good book. If it's not making a mistake, then the book is *very* out of date.

If it's the only book you got, then we'll try to make the best of it.

As for classpath... please do NOT concern yourself with classpath if you are using Tomcat. Tomcat does NOT use the system CLASSPATH variable. Simply installing Tomcat and setting CATALINA_HOME variable is all you need. This is explained in the Tomcat installation documents.

The only time you worry about classpath is when you are *compiling* servlets. And this is more appropriately handled by sending the path to servlet.jar (the jar file that contains all the servlet API classes) as a command-line switch to javac.

Something like:

javac -classpath .;%CATALINA_HOME%/common/lib/servlet.jar MyServletClass.java
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another suggestion ... If you don't want to spend the time learning Ant(recommended) and you don't want to have to keep typing out this long command line just to compile servlet(s) i.e. and believe me, you will be doing this alot. I would recommend creating and storing this information in a CLASSPATH environment variable for example
This particular line of code uses the j2ee.jar file from the enterprise edition which includes the servlet api and among others. Which you can also download form Sun's website.
Or you can just use the servlet.jar file from tomcat, for example

Also one more thing don't forget the period, it says include your PWD(present working directory) as apart of your classpath.
Now all you have to do at the command line is

But choose the way that is more efficient for you.

craig
 
ramakrishna pydipati
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very much . I really appreciate u r help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic