Servlet class

ok the servlet class is suppose to be in the j2sdk1.4.0right well every time i try to compile a servlet it tells me the package does not exist like when i use import java.servlet.*;. What im i doing wrong and how can i fix this . thanks

did you recently download the j2sdk1.4? Did you used to have 1.3.1? If so...you may need to change which javac you are using...If you use a IDE make sure the settings point to the new j2sdk1.4 instead of 1.3.1

Similar Messages

  • How can i make a servlet (class) temporarily unavailable, except for ADMIN

    Hello All!
    I am rather new to the programming field and have already completed a web-project in Java only with Servlets. (no jsp). I have a login procedure, means I have a user management for users and admins. If an admin is logged in, he/she should be able to deactivate the servlet with a mouse-click as long he activates it again with the same. if the servlet is deactivated, other users/admins trying to access the servlet should get a "servlet is currently unavailable" message. but the admin, who is logged in, still should be able to work with the servlet! how can i realise that?
    in other words, by clicking that particular button, the servlet should be made "non-multi-thread" and other way round by activating it.
    any ideas??? how can the standard "servlet currently unavailable" page be displayed? I have tomcat 4 on a linux machine! i'd be really grateful if someone oculd help me.
    another question i have is, how to define a "pseudo" link address to the servlet. now, the servlet can only be accessed by typing like this: http://servername.xy.com:8080/ProjectName/servlet/ServletName (because I have activated the servlet mapping in the server.xml/web.xml with /servlet/*)
    but I want a link like this: http://servername.xy.com:8080/shortname
    How can I do this in an easy way?? I have treid to create a web.xml in der WEB-INF folder of the servlet with following content, but it is not working:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>
    shortname
    </servlet-name>
    <servlet-class>
    ClassName
    </servlet-class>
    </servlet>
    </web-app>
    Thanks a lot in advance for your kind help,
    lisa

    Ok,
    You'll need to find a tutorial on servlet filters. Its not that hard a concept.
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/Servlets8.html#wp64572
    Filters need to be configured in the web.xml.
    Basically they are a buffer between a request and your servlet.
    Any requests for the servlet, go through the filter first. It lets you do some processing before/after the servlet gets called. Its a good way of putting in some generic code that need to be run for many servlets - security checks are often implemented in this fashion.
    This should give you an idea of the sort of thing you need. I haven't really written one before, so I copied this out of the tutorial and did some basic framework for it....
    public final class TestFilter implements Filter {
       private FilterConfig filterConfig = null;
       public void init(FilterConfig filterConfig) throws ServletException {
          this.filterConfig = filterConfig;
       public void destroy() {
          this.filterConfig = null;
       public void doFilter(ServletRequest request,  ServletResponse response, FilterChain chain) throws IOException, ServletException {
            // if you want to get the session will need to cast request to an HttpServletRequest
            Session session = request.getSession();
            String requestURL = request.getRequestURL();
            // check if this URL is for a servlet that is disabled for this user
           // somehow you have to keep track of this ... maybe in the servletContext ?
        User user = (User) session.getAttribute("user")     
          boolean disabled = checkDisabled(requestURL, user);
          // if its not disabled, go ahead
          if (!disabled)
            chain.doFilter(request, response);
        else{
            // send the servlet off somewhere else - requestDispatcher maybe?
    }

  • Unable to load servlet  class specified in the module.

    Hi,
    Hope that I am in the right Forum to ask this question.
    I tried to develop basic servlet example as specified in http://java.sun.com/developer/onlineTraining/J2EE/Intro2/servlet/servlet.html.
    When I create WAR file in Deployment tool I get the following error. How can I rectify this?
    Thank you very much for any help.
    Regards,
    Indika
    Error :
    Unable to load servlet class specified in the module.
    Please contact online help for assistance.
    java.lang.UnsupportedClassVersionError : bonus/controller/BonusCalculationServlet (Unsupported major.minor version 49.0)

    Hi Yohan_co,
    I haven't used Application Server 8.2, but I think the problem is because the jdk that AS is using is previous to the jdk that your are using to compile your source files.
    I hope that it helps you.
    Regards

  • Failed to load servlet Class: org.apache.jasper.servlet.JspServlet

    I am evaluating Weblogic 12c and is stuck in deployment of an application.
    My application is locally developed and is working fine in Oracle Glassfish. I have install glassfish and deploy application multiple time.
    In weblogic I can deploy the application successfully and the state= Prepared while Health=OK.
    When I access applicaiton from web browser, it says:
    Error 503--Service Unavailable
    From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
    10.5.4 503 Service Unavailable
    The server.log is having messages similar to following:
    When processing WebService module 'SHMA'. Failed to load servlet Class: org.apache.jasper.servlet.JspServlet
    Ignoring: unable to load class:java.lang.ClassNotFoundException: org.apache.jasper.servlet.JspServlet at: weblogic.xml.schema.binding.util.ClassUtil.loadClass(ClassUtil.java:76)
    Jun 4, 2013 5:59:36 PM com.sun.xml.ws.model.JavaMethodImpl freeze
    WARNING: Input Action on WSDL operation RegisterOperation and @Action on its associated Web Method registerOperation did not match and will cause problems in dispatching the requests
    Any idea about how to fix this??
    Application is working fine in Glassfish 3.2
    I am having RHEL6-3 x86 with JDK 1.6u45 for Bea Weblogic 12c.
    Thanks

    Probably not the right forum. But you have the honour of being the first person to ask a specific WebLogic Server question here.
    The BEA dev-2-dev site still seems to be active. Try here hunting for a category here: http://forums.bea.com/index.jspa
    -steve-

  • How to publish a servlet class to web server?

    background:
    web server: tomcat apache 4
    context path: webapp\test\
    servlet path: webapp\test\WEB-INF
    servlet name: HelloWorld.class
    i tried to placed the servlet class file to above servlet path,
    but i can't invoke the servlet by http://localhost:8080/test/HelloWorld
    what should i do in order to invoke the servlet at browser?
    Is a web.xml necessary a must to provided a mapping between request name and actual class name?

    First of all you need a *.war structure which look like this
    /app-name
    /app-name/WEB-INF/
    /app-name/WEB-INF/lib
    /app-name/WEB-INF/classes
    When you have created this structure you add your servlet (HelloWorld.class) in the classes directory (Create the package structure first).
    When this is done you need to map the servlet to a given uri which is done in the web.xml. An example is found below:
    <servlet>
    <servlet-name>hello</servlet-name>
    <servlet-class>package.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>hello</servlet-name>
    <url-pattern>/hello/*</url-pattern>
    </servlet-mapping>
    Hopefully this will help :-)
    best regards
    Stig

  • Problem in compiling servlet class - using Tomcat

    Hi,
    I have a servlet pgm that I'm trying to compile.I using Tomcat application server.I have my servlet class in D:\servlet_wrk\project1\src
    and my deployment descriptor in D:\servlet_wrk\project1\etc
    my CLASSPATH var is set to C:\Sun\AppServer\jdk\bin
    and
    my PATH var is set to C:\Sun\AppServer\bin.
    When I compile my servlet class Ch1Servlet.java in the command line from the directory
    D:\servlet_wrk\project1 using the command
    javac -classpath D:\applications\tomcat-5.5.12\common\lib\servlet-api.jar -d classes src/Ch1Servlet.java,
    it says error:cannot read: src/Ch1Servlet.java
    Can somebody help me to solve this problem and help me to compile my servlet class.
    Thanks.

    Thanks...as u said I tried putting dir & found that
    my file was saved as Ch1Servlet.java.txt instead for
    Ch1Servlet.java......So that was a problem.Now I'm
    able to compile.Oh, yeah. Notepad will do that to you. I think when you save in Notepad if you put quotes around the name "Whatever.java" then it won't add the .txt.
    But on compiling I'm getting the following error
    package java.servlet.* does not exist
    package java.servlet.http.* does not exist
    package java.io.* does not exist
    Do u the reason for this??? The servlet stuff is java[b]x.servlet. For the io stuff, I don't know, I'd have to see your code. Either you have a typo or a corrupt installation.

  • Servlet class path

    Can anybody tell me what is the exact path to put the servlet class file in
    tomcat 4. I was reading a book called more servelet by Marty Hall and its metioned there that i can put them in install_dir/webapps/ROOT/WEB-INF/classes but when i browse to WEB-INF folder there is no folder named classes there.
    Please help.

    firsly i installed jdk 1.3 on my computer. Then i installed tomcat 4. Then i changed port 8080 in server.xml to 80. Then i set the JAVA_HOME path to point to jdk1.3 folder. Then i setup the class path to D:\Documents and Settings\Ashi\Desktop\tomcat\apache-tomcat-4.1.34\apache-tomcat-4.1.34\common\lib\servlet.jar
    Then i downloaded a source file named HelloServlet.java from author's website and compiled it. It compiled successfully. I copied the HelloServlet.class file to the classes directory that you asked me to create. Then i opened my browser and typed http://localhost/servlet/HelloServlet and getting error HTTP Status 404

  • Non-servlet class in servlet program

    hi,
    I declare a non-servlet class which is defined by myself in a servlet class. I passed the complie but got an runtime error said NoClassDefFoundError. Does anyone can help me? Thanks.
    The following is my code.
    //get the search string from web form
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.net.*;
    import java.util.*;
    public class SearchEngines extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {   
    String searchString = (String) request.getParameter("searchString");
         String searchType = (String) request.getParameter("searchType");
         Date date = new java.util.Date();
         response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Vector doc_retrieved = new Vector();
    BooleanSearch bs = new BooleanSearch();
    doc_retrieved=bs.beginSearch(searchString, searchType);
    out.println("<HTML><HEAD><TITLE>Hello Client!</TITLE>" +
                   "</HEAD><BODY>Hello Client! " + doc_retrieved.size() + " documents have been found.</BODY></HTML>");
    out.close();
    response.sendError(response.SC_NOT_FOUND,
    "No recognized search engine specified.");
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    // a search engine implements the boolean search
    import java.io.*;
    import java.util.*;
    import au.com.pharos.gdbm.GdbmFile;
    import au.com.pharos.gdbm.GdbmException;
    import au.com.pharos.packing.StringPacking;
    import IRUtilities.Porter;
    public class BooleanSearch{
         BooleanSearch(){;}
         public Vector beginSearch(String searchString, String searchType){
              Vector query_vector = queryVector(searchString);
              Vector doc_retrieved = new Vector();
              if (searchType.equals("AND"))
                   doc_retrieved = andSearch(query_vector);
              else
                   doc_retrieved = orSearch(query_vector);
              return doc_retrieved;
         private Vector queryVector(String query){
         Vector query_vector = new Vector();
              try{
                   GdbmFile dbTerm = new GdbmFile("Term.gdbm", GdbmFile.READER);
              dbTerm.setKeyPacking(new StringPacking());
              dbTerm.setValuePacking(new StringPacking());
              query = query.toLowerCase();
              StringTokenizer st = new StringTokenizer(query);
              String word = "";
              String term_id = "";
              while (st.hasMoreTokens()){
                   word = st.nextToken();
                   if (!search(word)){
                        word = Stemming(word);
                        if (dbTerm.exists(word)){
                   //          System.out.println(word);
                             term_id = (String) dbTerm.fetch(word);
                             query_vector.add(term_id);
              catch(GdbmException e){
                   System.out.println(e.getMessage());
              return query_vector;
         private Vector orSearch(Vector query_vector){
              Vector doc_retrieved = new Vector();
              try{
                   GdbmFile dbVector = new GdbmFile("Vector.gdbm", GdbmFile.READER);
                   dbVector.setKeyPacking(new StringPacking());
                   dbVector.setValuePacking(new StringPacking());
                   int doc_num = dbVector.size();
                   String doc_id = "";
                   String temp = "";
                   for (int i = 1; i <= doc_num; i++){
                        boolean found = false;
                        doc_id = String.valueOf(i);
                        temp = (String) dbVector.fetch(doc_id);
                        StringTokenizer st = new StringTokenizer(temp);
                        while (st.hasMoreTokens() && !found){
                             temp = st.nextToken();
                             StringTokenizer st1 = new StringTokenizer(temp, ",");
                             String term = st1.nextToken();
                             if (query_vector.contains(term)){
                                  doc_retrieved.add(doc_id);
                                  found = true;
              catch(GdbmException e){
                   System.out.println(e.getMessage());
              return doc_retrieved;
         private Vector andSearch(Vector query_vector){
              Vector doc_retrieved = new Vector();
              try{
                   GdbmFile dbVector = new GdbmFile("Vector.gdbm", GdbmFile.READER);
                   dbVector.setKeyPacking(new StringPacking());
                   dbVector.setValuePacking(new StringPacking());
                   int doc_num = dbVector.size();
                   String doc_id = "";
                   String temp = "";
                   for (int i = 1; i <= doc_num; i++){
                        Vector doc_vector = new Vector();
                        boolean found = true;
                        doc_id = String.valueOf(i);
                        temp = (String) dbVector.fetch(doc_id);
                        StringTokenizer st = new StringTokenizer(temp);
                        while (st.hasMoreTokens()){
                             temp = st.nextToken();
                             StringTokenizer st1 = new StringTokenizer(temp, ",");
                             String term = st1.nextToken();
                             doc_vector.add(term);
                        for (int j = 0; j < query_vector.size(); j++){
                             temp = (String) query_vector.get(j);
                             if (doc_vector.contains(temp))
                                  found = found & true;
                             else
                                  found = false;
                        if (found)
                             doc_retrieved.add(doc_id);
              catch(GdbmException e){
                   System.out.println(e.getMessage());
              return doc_retrieved;
         private String Stemming(String str){
              Porter st = new Porter ();
              str = st.stripAffixes(str);
              return str;          
         private boolean search(String str){
              //stop word list
              String [] stoplist ={"a","about","above","according","across","actually","adj","after","afterwards","again",
                                       "against","all","almost","alone","along","already","also","although","always","am","among",
                                       "amongst","an","and","another","any","anyhow","anyone","anything","anywhere","are",
                                       "aren't","around","as","at","away","be","became","because","become","becomes","becoming",
                                       "been","before","beforehand","begin","beginning","behind","being","below","beside",
                                       "besides","between","beyond","billion","both","but","by","can","cannot","can't",
                                       "caption","co","co.","could","couldn't","did","didn't","do","does","doesn't","don't",
                                       "down","during","each","eg","eight","eighty","either","else","elsewhere","end","ending",
                                       "enough","etc","even","ever","every","everyone","everything","everywhere","except",
                                       "few","fifty","first","five","for","former","formerly","forty","found","four","from",
                                       "further","had","has","hasn't","have","haven't","he","he'd","he'll","hence","her","here",
                                       "hereafter","hereby","herein","here's","hereupon","hers","he's","him","himself","his",
                                       "how","however","hundred","i'd","ie","if","i'll","i'm","in","inc.","indeed","instead",
                                       "into","is","isn't","it","its","it's","itself","i've","last","later","latter","latterly",
                                       "least","less","let","let's","like","likely","ltd","made","make","makes","many","maybe",
                                       "me","meantime","meanwhile","might","million","miss","more","moreover","most","mostly",
                                       "mr","mrs","much","must","my","myself","namely","neither","never","nevertheless","next",
                                       "nine","ninety","no","nobody","none","nonetheless","noone","nor","not","nothing","now",
                                       "nowhere","of","off","often","on","once","one","one's","only","onto","or","other","others",
                                       "otherwise","our","ours","ourselves","out","over","overall","own","per","perhaps","pm",
                                       "rather","recent","recently","same","seem","seemed","seeming","seems","seven","seventy",
                                       "several","she","she'd","she'll","she's","should","shouldn't","since","six","sixty",
                                       "so","some","somehow","someone","sometime","sometimes","somewhere","still","stop",
                                       "such","taking","ten","than","that","that'll","that's","that've","the","their","them",
                                       "themselves","then","thence","there","thereafter","thereby","there'd","therefore",
                                       "therein","there'll","there're","there's","thereupon","there've","these","they","they'd",
                                       "they'll","they're","they've","thirty","this","those","though","thousand","three","through",
                                       "throughout","thru","thus","to","together","too","toward","towards","trillion","twenty",
                                       "two","under","unless","unlike","unlikely","until","up","upon","us","used","using",
                                       "very","via","was","wasn't","we","we'd","well","we'll","were","we're","weren't","we've",
                                       "what","whatever","what'll","what's","what've","when","whence","whenever","where",
                                       "whereafter","whereas","whereby","wherein","where's","whereupon","wherever","whether",
                                       "which","while","whither","who","who'd","whoever","whole","who'll","whom","whomever",
                                       "who's","whose","why","will","with","within","without","won't","would","wouldn't",
                                       "yes","yet","you","you'd","you'll","your","you're","yours","yourself","you've"};
              int i = 0;
              int j = stoplist.length;
              int mid = 0;
              boolean found = false;
              while (i < j && !found){
                   mid = (i + j)/2;
                   if (str.compareTo(stoplist[mid]) == 0)
                        found = true;
                   else
                        if (str.compareTo(stoplist[mid]) < 0)
                             j = mid;
                        else
                             i = mid + 1;
              return found;
         }

    please show us the full error message.
    it sounds like a classpath problem...

  • How to access an external text file in a Servlet class?

    I do the regular file I/O in the Servlet class. But when I run Servlet class, text file is not loaded. Can sb tell me how to do it?
    Thanx
    Richard

    Hi DrClap;
    the following is the main servlet code, which calls other two classes.
    ===================================================================
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class TermsServlet extends HttpServlet {
              public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
              resp.setContentType("text/html");
              PrintWriter out = resp.getWriter();
              out.println("<HTML>");
              out.println("<TITLE>Computer Terms and Acronyms</TITLE>");
              out.println("<BODY>");
              out.println("<H1>Computer Terms and Acronyms</H1>");
              out.println("<TABLE BORDER=2>");
              out.println("<TR><TH>Term<TH>Meaning</TR>");
              TermsAccessor tax = new TermsAccessor("terms.txt");
              Iterator e = tax.iterator();
              while (e.hasNext()) {
                   Term t = (Term)e.next();
                   out.print("<TR><TD>");
                   out.print(t.term);
                   out.print("<TD>");
                   out.print(t.definition);
                   out.println("</TR>");
              out.println("</TABLE>");
              out.println("<HR></HR>");
              out.println("</BODY></HTML>");
    =================================================
    import java.io.*;
    import java.util.*;
    public class TermsAccessor {
         protected BufferedReader is;
         protected String ident;
         public TermsAccessor(String inputFileName) throws IOException {
              is = new BufferedReader(new FileReader(inputFileName));
              String ident = is.readLine();
         public String getIdent() {
              return ident;
         public Iterator iterator() {
         return new Iterator() {
              String line, term, defn;
    public boolean hasNext() {
              try {
              return ((line = is.readLine()) != null);
              } catch (IOException e) {
              System.err.println("IO Error: " + e);
              return false;
              public Object next() {
              int i;
              while ((i = line.indexOf("\t"))<0 && hasNext());
              if (line == null)
              throw new IllegalStateException("Invalid EOF state");
                        term = line.substring(0, i);
                        defn = line.substring(i+1);
                        return new Term(term, defn);
              public void remove() {
              throw new UnsupportedOperationException();
    =============================================================
    public class Term {
              public String term;
              public String definition;
              public Term(String t, String d) {
              term = t;
              definition = d;
    =================================================================
    part of [terms.txt] file as following:
    $Id: terms.txt,v 1.5 2000/03/17 04:08:55 $
    AMD     American Micro Devices: a chip maker that competes with Intel.
    API     Application Programmer Interface: a set of functions that a programmer can use
    ASP     Active Server Pages, a Microsoft technology for imbedding certain commands in HTML pages
    BSD     Berkeley Software Distribution, one of the two major flavors of UNIX. See OpenBSD
    C     A computer programming language invented for writing UNIX in, and very popular in the late 1970's through the 1990's
    C++     An Object-Oriented language heavily based on C; recently displaced by Java
    CGI     Common Gateway Interface; a script or program used to handle a form on a web page
    COBOL     COmmon Business Oriented Language, a programming language used mainly for large-scale financial applications.
    CPU     Central Processing Unit, the "chip" that gives a computer its low-level personality ("machine instruction set") and performs individual instructions (add, multiply, compare...). Common CPUs include Intel/AMD "PC", SPARC, Alpha.
    =================================================================
    the "terms.txt" file and above class files are under the same directory. I use J2EE server to deploy the file, after run, the erro mesage is:"The requested resource (terms.txt (The system cannot find the file specified)) is not available." That means server can not locate the terms.txt file. So what file path should I use?
    Thanx
    Richard

  • Problems importing servlet classes

    When I try to compile a bean which has import statements for importing servlet classes, I get the message that the class is not found in import when I compile the code. I have all these class files and I'm not sure whether I've placed them aptly. Please give me the details about placing the servlet classes and configuring my javac to import these classes.
    Thanks!

    If you place your classes in the %JAVA_HOME%/jre/lib/ext, they will be automatically accepted by the javac and the java. But, depending on the classes you use, it would be better to include them in %application path%/WEB-INF/lib, so they will only be used by that application.

  • How can I find the servlet class name from inside a ServletFilter?

    Ive implemented a servlet filter, but need to discover the class name of any servlet class that gets executed.
    Ive dug through the spec and cant seem to find any path to do this.
    Seems the methods needed to do this have been deprecated. (for security reasons?)
    Is there any way to write a ServletFilter to grab this info?
    If not, is there any other way to capture every servlet execution in the container, time its execution, and log the class name along with the execution time?
    (***WITHOUT*** requiring a classpath over ride of any container provider classes)
    Any help is much appreciated. Been banging my head against this for some time now :(

    request.getServletPath() returns the part of the URL which refers to the servlet. It isn't the classname of the servlet but it should be a reasonable surrogate. If you log that, then you could write some code which reads your web.xml and uses the servlet-mapping elements to convert it to servlet class names later.

  • Tomcat session expires after compiling servlet/ class

    Hi,
    Does anybody know why tomcat(4.1) session expires if you modify a serlvet or class and compile it.
    After compiling I refresh the page and I get session invalidated page. And every time I compile I have to relogin.
    Any ideas ? Is there a work around ?

    In serverl.xml, if you have set the reloadable="true" attribute in your <Context/> tag for your web application then each time one of the servlet classes is modified, tomcat will reload the web application. Set reloadable="false" and this will stop.
    tobes

  • Compiling servlet class:javac gives 'bad command'

    I have a servlet class in the path: E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    I am using Tomcat 3.2.4 and Just Go (the tomcat launcher) provides this log of my settings:
    CLASSPATH:
    .;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\servlet.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\ant.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jaxp.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\crimson.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\webserver.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jasper.jar
    Executable :
    E:\JBuilder35\jdk1.2.2\jre\bin\java.exe
    Command line arguments (in order appended) :
    -Dtomcat.home=E:\Tomcat324\jakarta-tomcat-3.2.4
    org.apache.tomcat.startup.Tomcat
    Environment Vars :
    TOMCAT_HOME=E:\Tomcat324\jakarta-tomcat-3.2.4
    TOMCAT_LIB=E:\Tomcat324\jakarta-tomcat-3.2.4\lib
    JAVA_HOME=E:\JBuilder35\jdk1.2.2\jre
    JAVA_EXE=E:\JBuilder35\jdk1.2.2\jre\bin\java.exe
    WINDIR=C:\WINDOWS
    CLASSPATH=.;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\servlet.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\ant.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jaxp.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\crimson.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\webserver.jar;E:\Tomcat324\jakarta-tomcat-3.2.4\lib\jasper.jar
    In my DOS screen, I go to the path E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes and type in "javac helloWorld.java" and I get the message :Bad Command or File Name
    I'd greatly appreciate it if anyone could tell me what path to use in DOS to enable me to use the javac command.
    My problem is there are so many paths in the Tomcat settings (above), I am not sure which one to use to compile my servlet.

    Thanks for the suggestion. I am not trying to use JBuilder, just the command line from DOS so I hope that won't impact this.
    JAVAC is in e:\jbuilder35\jdk1.2.2\bin
    and the class that I am trying to run is in:
    e:\tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    and it's called CookieExample.java
    Here's a copy of my DOS Screen of what I did and the result:
    E:\>set path = javac e:\jbuilder35\jdk1.2.2\bin;%path%
    E:\>cd e:\tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes
    E:\Tomcat324\jakarta-tomcat-3.2.4\webapps\examples\WEB-INF\classes>javac CookieE
    xample.java
    Bad command or file name
    -Any idea why I am still getting the error?

  • Getting servlet class corresponding to jsp?

    Hi,
              I'm running WebLogic 5.1, sp12 for Solaris. I was wondering if
              someone could provide me with a small snippet of java code that would
              tell me the class name, or at least path to the servlet class that
              corresponds to a jsp page. So, for example, if I knew my jsp path was
              /mypath/http/myapp/dummy.jsp
              it would be great to get the class name which, in this example, might
              be:
              jsp_servlet._myapp.__dummy
              Thanks in advance, Dave A.
              

    Programmatically, I don't know of a way to do that in java.
              Bill
              "D. Alvarado" wrote:
              > Thanks for your reply, What if you wanted to get the classname of a
              > particular jsp from another jsp? For example, what if I wanted to
              > know the class name of "/mypath/http/myapp/dummy.jsp" if I'm writing
              > code in "mypath/http/myapp/another.jsp"?
              >
              > Thanks, Dave
              >
              > William Kemp <[email protected]> wrote in message news:<[email protected]>...
              > > this.getClass().getName() will give you the name of the class at runtime.
              > >
              > > Bill
              > >
              > > "D. Alvarado" wrote:
              > >
              > > > Hi,
              > > > I'm running WebLogic 5.1, sp12 for Solaris. I was wondering if
              > > > someone could provide me with a small snippet of java code that would
              > > > tell me the class name, or at least path to the servlet class that
              > > > corresponds to a jsp page. So, for example, if I knew my jsp path was
              > > >
              > > > /mypath/http/myapp/dummy.jsp
              > > >
              > > > it would be great to get the class name which, in this example, might
              > > > be:
              > > >
              > > > jsp_servlet._myapp.__dummy
              > > >
              > > > Thanks in advance, Dave A.
              

  • Problem for retriveing servlet class file (error in DD) I think so

    hi to all ,
    my deployment descriptor is here ....
    I tried to access servlet ... I got the response is like that
    The requested Resource is not available
    why its happening ?
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <welcome-file-list>
         <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <listener>
         <listener-class>CallMonitor.MyListener</listener-class>
    </listener>
    <servlet>
         <servlet-name>LoginAction</servlet-name>
         <servlet-class>LoginAction</servlet-class>
    </servlet>
    <servlet>
         <servlet-name>InsertData</servlet-name>
         <servlet-class>InsertData</servelt-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>LoginAction</servlet-name>
         <url-pattern>/LoginAction</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
         <servlet-name>InsertData</servlet-name>
         <url-pattern>/InsertData</url-pattern>
    </servlet-mapping>
    <context-param>
         <param-name>jdbcurl</param-name>
         <param-value>jdbc:mysql://localhost:3306/test</param-value>
    </context-param>
    </web-app>But i remove the code from it , i can access LoginAction Servlet..
    <servlet>
         <servlet-name>InsertData</servlet-name>
         <servlet-class>InsertData</servelt-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>InsertData</servlet-name>
         <url-pattern>/InsertData</url-pattern>
    </servlet-mapping>
    In Tomcat manager i found the applicaton is not running.
    i started the application using start command...
    But i got error message
    FAIL - Application at context path /25.7 could not be started
    Message was edited by:
    kannankalli

    <servlet-class>InsertData</servelt-class>Closing element for <servlet-class> is wrong.
    Before posting for any help check following stuff
    - Whether deployment descriptor is well-formed
    - Whether it is valid i.e. all elements are properly placed

  • Retrieve ServletContext from non-servlet class

    A servlet calls a method which is located in another class which is not a servlet. Within this method of the non-servlet class, i need to access the ServletContext of the servlet that has called the method. What i am currently doing is simply passing the ServletContext as a parameter to the method.
    I would like to avoid passing the ServletContext all the time, so i'm wondering if it's possible, from the non-servlet class, to retrieve the ServletContext of the servlet which has called the method of the non-servlet class.

    Thanks J-Fine, that's a smart suggestion. BTW in the meantime i figured out that passing the ServletContext is not that bad idea, after all it reflects the structure of the app. However if i'll change my mind again i'll do like you suggested.

Maybe you are looking for

  • AttributeValuePair settings for Subject of Policy Creation

    Hi, I am trying to create policies using the command line tool amadmin. At this point I can create the policy with the desired rule but the subject isn't created properly. I am using Identity Server 6.1 on Solaris 9 and Directory Server 5.2 on a diff

  • Dreamweaver and fireworks and css

    hey guys im a complete noob when it comes to dreamweaver, i made my navigation menu in fireworks, exported it as htm file to the same dir as index.html opened up dreamweaver index webpage, imported the .htm file using insert>image>objects>Fireworks h

  • Too low initial heap size

    Hi, Any idea why following line is giving too low initial heap size error in server startup. $JAVA_HOME/bin/java $JAVA_VM -XX:NewSize=256m -XX:MaxNewSize=256m -XX:SurvivorRatio=6 -Xms2048m -Xmx2048m -Xrs -verbose:gc This error is coming when I am add

  • External Web Service as Legacy System

    Hi, when I use a File -> XI -> JDBC scenario, I have to define into XI (using a particular transaction...) the FTP server from which XI has to consume the XML source files. Now... I have to do the same if I use a web service instead of a File as sour

  • Keeping the current date in the dock

    When I first started to use iCal once opened the date would stay in the dock but now after i quit the date changes back to July 17(the day in 2002 iCal was released.) Before one of the updates the correct date would only change back if I forced quit.