Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

problem in compiling servlet/jsp

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have sun application server and tomcat both. i wrote program of servlet but when i am compiling it .it is saying import servlet package etc. i want to know;-

1) what setting i have to do after installing sun application server and tomcat on computer so that my program(servlet/jsp) compile properly?

2) and how i do that?

i have window xp sp2
location of my sun application server installed is=D:\Sun\AppServer
location of my tomcat server is =D:\program files\Apache Software Foundation\Tomcat 6.0


please tell me i am tring form so many days. please helppppppppp .me

thank you. looking for your replies.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi pankaj goswami,

We have a FAQ entry with some information on compiling servlets that you might find helpful.

http://faq.javaranch.com/java/CompilingServlets

I'm going to move this to our Java In General (Beginner) forum where javac, and classpath issues are discussed.

-Ben
 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i add my class path as:

start->my computer->properties->advance->environment variables- select class path->and than i write my application server drive path i.e(D:\Sun\AppServer\lib\j2ee.jar.


but when i compile servlet program it says again and again import servlet package etc.

is i am setting class path wrong. and if am i. what is correct one.

thanks in advance.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Open up a command window and type:


It should print your classpath.
See if that matches the path to your j2ee.jar file.
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear pankaj goswami


Can you show to us , what exception should be thrown while in the compile time ?

Because, if you are using servlet t, you should import all servlet package like

import javax.servlet.http.*
or
import javax.servlet.*

which is available in the tomcat server or j2ee server .

Check and tell me your feedback.
 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is error which it is showing to me.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\PANKAJ>


C:\Documents and Settings\PANKAJ>f:

F:\>javac EmployeeDetails.java
EmployeeDetails.java:3: package javax.servlet does not exist
import javax.servlet.*;
^
EmployeeDetails.java:4: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
EmployeeDetails.java:5: cannot find symbol
symbol: class HttpServlet
public class EmployeeDetails extends HttpServlet
^
EmployeeDetails.java:9: cannot find symbol
symbol : class PrinterWriter
location: class EmployeeDetails
PrinterWriter out;
^
EmployeeDetails.java:10: cannot find symbol
symbol : class Resultset
location: class EmployeeDetails
Resultset rs;
^
EmployeeDetails.java:18: cannot find symbol
symbol : class HttpServletRequest
location: class EmployeeDetails
public void doGet(HttpServletRequest request,HttpServletResponse Response)throws
ServletException,IOException
^
EmployeeDetails.java:18: cannot find symbol
symbol : class HttpServletResponse
location: class EmployeeDetails
public void doGet(HttpServletRequest request,HttpServletResponse Response)throws
ServletException,IOException
^
EmployeeDetails.java:18: cannot find symbol
symbol : class ServletException
location: class EmployeeDetails
public void doGet(HttpServletRequest request,HttpServletResponse Response)throws
ServletException,IOException

^
EmployeeDetails.java:21: cannot find symbol
symbol : variable response
location: class EmployeeDetails
out=response.getWriter();
^
EmployeeDetails.java:25: cannot find symbol
symbol : method forname(java.lang.String)
location: class java.lang.Class
Class.forname("sun.jdbc.odbc.jdbcodbcDriver");
^
EmployeeDetails.java:30: cannot find symbol
symbol : method preparedStatement(java.lang.String)
location: interface java.sql.Connection
pstmt=con.preparedStatement(query);
^
EmployeeDetails.java:31: cannot find symbol
symbol : variable Integer
location: class EmployeeDetails
pstmt.setInt(1,Integer,parseInt(request.getParameter("id")));
^
EmployeeDetails.java:34: cannot find symbol
symbol : method getMetaData()
location: class EmployeeDetails
ResultSetMetaData rsmd=rs=getMetaData();
^
EmployeeDetails.java:36: cannot find symbol
symbol : variable put
location: class EmployeeDetails
put.println("<TABLE ALIGN=CENTRE BORDER=1 CELLPADDING=2>");
^
14 errors

F:\>
 
pankaj goswami
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes when i am writting echo%classpath%.it is matching.so where i am going wrong
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic