Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35167

Re: How to direct javac to search a jar file?

Newsgroups comp.lang.java.programmer
Date 2016-08-02 08:11 -0700
References <nnqbs5$gs6$1@gioia.aioe.org>
Message-ID <de67cc6f-961e-4552-8db2-6efc9f4fb620@googlegroups.com> (permalink)
Subject Re: How to direct javac to search a jar file?
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Tuesday, August 2, 2016 at 10:48:52 AM UTC-4, parmenides wrote:
> Hi,
> 
>     I'm learning how to write servlet. There is an example like this:
> 
> package home.parmenides;
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> public class Hello extends HttpServlet{
>     public void init(ServletConfig config) throws ServletException{
>        super.init(config);
>     }
>     public void service(HttpServletRequest reqest,HttpServletResponse 
> response) throws IOException{
>        response.setContentType("text/html;charset=utf-8");
>        PrintWriter out=response.getWriter();
>        out.println("<html><body>");
>        out.println("<h2>Welcome to servlet。</h2>");
>        out.println("</body></html>");
>     }
> }
> 
> Now that packages of servlet are imported. According to the tutorial, 
> these packages are archived in the C:\Tomcat 9.0\lib\servlet-api.jar, 
> and it is necessary to copy the file to a JDK directory, namely 
> C:\java\jre\lib. This works indeed. But, I think it is more convenience 
> to let javac to find the file rather than copying file. I added the 
> following path into the classpath:
>                 C:\Tomcat 9.0\lib
> But, javac can not find the servlet-api.jar. How can I deal with the 
> problem? Thanks.

Include the jar (or folder?) in your classpath.  The -cp parameter.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to direct javac to search a jar file? parmenides <xparmenides@yahoo.com> - 2016-08-02 22:48 +0800
  Re: How to direct javac to search a jar file? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-02 08:11 -0700
  Re: How to direct javac to search a jar file? Nigel Wade <nmw@local.domain> - 2016-08-02 17:50 +0100
    Re: How to direct javac to search a jar file? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-02 10:49 -0700
      Re: How to direct javac to search a jar file? Lew <lewbloch@gmail.com> - 2016-08-02 10:53 -0700
        Re: How to direct javac to search a jar file? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-02 11:11 -0700
          Re: How to direct javac to search a jar file? Lew <lewbloch@gmail.com> - 2016-08-02 13:23 -0700
            Re: How to direct javac to search a jar file? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-03 05:32 -0700
              Re: How to direct javac to search a jar file? Nigel Wade <nmw@local.domain> - 2016-08-03 14:30 +0100
                Re: How to direct javac to search a jar file? Eric Douglas <e.d.programmer@gmail.com> - 2016-08-03 12:02 -0700
                Re: How to direct javac to search a jar file? Arne Vajhøj <arne@vajhoej.dk> - 2016-08-03 19:34 -0400
                Re: How to direct javac to search a jar file? Nigel Wade <nmw@local.domain> - 2016-08-04 14:22 +0100
              Re: How to direct javac to search a jar file? Arne Vajhøj <arne@vajhoej.dk> - 2016-08-03 21:25 -0400
              Re: How to direct javac to search a jar file? Lew <lewbloch@gmail.com> - 2016-08-05 15:31 -0700

csiph-web