当前位置: 技术问答>java相关
下面的java程序我想用命令行的方式进行编译
来源: 互联网 发布时间:2015-09-17
本文导语: 命令行怎么写: 当前的classpath为 .;c:java2lib;c:java2libtools.jar;c:java2libdt.jar;c:java2jrelib;C:OracleOra81jdbclibclasses12.zip;C:OracleOra81jdbclibnls_charset12.zip 我这样写少了什么jar javac HelloWorldExample.java /* $Id: HelloWorldExample.java,v 1.1.4...
命令行怎么写:
当前的classpath为
.;c:java2lib;c:java2libtools.jar;c:java2libdt.jar;c:java2jrelib;C:OracleOra81jdbclibclasses12.zip;C:OracleOra81jdbclibnls_charset12.zip
我这样写少了什么jar
javac HelloWorldExample.java
/* $Id: HelloWorldExample.java,v 1.1.4.1 2001/11/29 18:28:41 remm Exp $
*
*/
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* The simplest possible servlet.
*
* @author James Duncan Davidson
*/
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
ResourceBundle rb =
ResourceBundle.getBundle("LocalStrings",request.getLocale());
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
out.println("");
String title = rb.getString("helloworld.title");
out.println("" + title + "");
out.println("");
out.println("");
// note that all links are created to be relative. this
// ensures that we can move the web application that this
// servlet belongs to to a different place in the url
// tree and not have any harmful side effects.
// XXX
// making these absolute till we work out the
// addition of a PathInfo issue
out.println("");
out.println("");
out.println("");
out.println("");
out.println("" + title + "");
out.println("");
out.println("");
}
}
当前的classpath为
.;c:java2lib;c:java2libtools.jar;c:java2libdt.jar;c:java2jrelib;C:OracleOra81jdbclibclasses12.zip;C:OracleOra81jdbclibnls_charset12.zip
我这样写少了什么jar
javac HelloWorldExample.java
/* $Id: HelloWorldExample.java,v 1.1.4.1 2001/11/29 18:28:41 remm Exp $
*
*/
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* The simplest possible servlet.
*
* @author James Duncan Davidson
*/
public class HelloWorld extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
ResourceBundle rb =
ResourceBundle.getBundle("LocalStrings",request.getLocale());
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("");
out.println("");
String title = rb.getString("helloworld.title");
out.println("" + title + "");
out.println("");
out.println("");
// note that all links are created to be relative. this
// ensures that we can move the web application that this
// servlet belongs to to a different place in the url
// tree and not have any harmful side effects.
// XXX
// making these absolute till we work out the
// addition of a PathInfo issue
out.println("");
out.println("");
out.println("");
out.println("");
out.println("" + title + "");
out.println("");
out.println("");
}
}
|
有servlet.jar吗?
错误信息是什么?
错误信息是什么?
|
到SUN网站当个servlet.jar包,然后加到classpath就应该没问题!
|
编译没问题
|
嗯,少加了servlet.jar
|
在tomcat下的lib中
21cnfox
21cnfox