File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

running a servlet without IDE

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • 0
  • 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

---------------------------------------------------------------
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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\" ?
 
Mike Ottinger
Ranch Hand
Posts: 125
  • 0
  • 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 Java Windows XP
  • 0
  • 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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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 Java Windows XP
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot ...Christophe Verre

regards,
seetharaman.v
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic