GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes running a servlet without IDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "running a servlet without IDE" Watch "running a servlet without IDE" New topic
Author

running a servlet without IDE

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Nov 24, 2005
Posts: 14688
    
  16

-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\" ?


[My Blog]
All roads lead to JavaRanch
Mike Ottinger
Ranch Hand

Joined: Jan 11, 2002
Posts: 125
Looks like you need the servlet.jar files in your project's classpath.


SCJP 1.4 SCJD 1.5
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

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

Joined: Nov 24, 2005
Posts: 14688
    
  16

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

Joined: Jan 28, 2008
Posts: 5575

Thanks a lot ...Christophe Verre

regards,
seetharaman.v
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: running a servlet without IDE