Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning 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
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

running a servlet without IDE

 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

i have a project1 directory in D:\project1..

under the directory i have 3 folders names ..1.src(Servlet1.java) 2.classes 3.etc(web.xml)..

my tomcate directory:C:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\

but when i try to compile the servlet i get below error..

please anyone can explain me..

thanks & regrds,
seetharaman.v
-----------------------------------------------------------------
D:\ja>javac -classpath C:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\comm
\lib\servlet-api.jar -d D:\project1\classes D:\project1\src\Servlet1.java
D:\project1\src\Servlet1.java:5: package javax.servlet does not exist
import javax.servlet.*;
^
D:\project1\src\Servlet1.java:6: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
D:\project1\src\Servlet1.java:7: package javax.servlet.http does not exist
import javax.servlet.http.HttpServletRequest;
^
D:\project1\src\Servlet1.java:8: package javax.servlet.http does not exist
import javax.servlet.http.HttpServletResponse;
^
D:\project1\src\Servlet1.java:10: cannot find symbol
symbol: class HttpServlet
public class Servlet1 extends HttpServlet {
^
D:\project1\src\Servlet1.java:37: cannot find symbol
symbol : class HttpServletRequest
location: class Servlet1
public void doGet(HttpServletRequest request, HttpServletResponse resp
se)
^
D:\project1\src\Servlet1.java:37: cannot find symbol
symbol : class HttpServletResponse
location: class Servlet1
public void doGet(HttpServletRequest request, HttpServletResponse resp
se)
^
D:\project1\src\Servlet1.java:38: cannot find symbol
symbol : class ServletException
location: class Servlet1
throws ServletException, IOException {
^
D:\project1\src\Servlet1.java:55: cannot find symbol
symbol : class ServletException
location: class Servlet1
public void init() throws ServletException {
^
D:\project1\src\Servlet1.java:23: cannot find symbol
symbol : variable super
location: class Servlet1
super.destroy(); // Just puts "destroy" string in log

^
10 errors

---------------------------------------------------------------
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

-classpath C:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\comm\lib\servlet-api.jar


Did you deliberately removed the spaces from the directory names ? And the common directory in Tomcat5 is called "common", not "comm".
What do you get when you execute "dir C:\ProgramFiles\ApacheSoftwareFoundation\Tomcat5.0\comm\lib\" ?
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like you need the servlet.jar files in your project's classpath.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi verre,

Actual path:C:\Program Files\Apache Software Foundation\Tomcat 5.0

but if i give space between path name i get this error..

please let me know the fact..
----------------------------------------------------------

D:\project1>javac -classpath C:\Program Files\Apache Software Foundation\Tomcat5
.0\common\lib\servlet-api.jar -d classes src\Servlet1.java
javac: invalid flag: Files\Apache
Usage: javac <options> <source files>
use -help for a list of possible options
--------------------------------------------
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use double quotations :
javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar" -d classes src\Servlet1.java
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot ...Christophe Verre

regards,
seetharaman.v
 
That new kid is a freak. Show him this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic