x******o 发帖数: 31 | 1 is there any way that I can run a servlet from command line (like run CGI from
console)?
i am new for java.
thanks, |
r***l 发帖数: 67 | 2 servlet needs to be running inside a servlet container, e.g. tomcat.
from
【在 x******o 的大作中提到】 : is there any way that I can run a servlet from command line (like run CGI from : console)? : i am new for java. : thanks,
|
x******o 发帖数: 31 | 3 thanks!
so there is no way to run from command line, right?
【在 r***l 的大作中提到】 : servlet needs to be running inside a servlet container, e.g. tomcat. : : from
|
r***l 发帖数: 67 | 4 The answer is Yes and No.
You can use mock object to simulate servlet environment and potentially
run/test your servlet without servlet container. However, that's more about
unit testing and it is an advanced topic.
Since you said you are new for Java, I do not want to confuse you here. So,
the answer is No. You can not run servlet from command line (without servlet
container). hehe
CGI
【在 x******o 的大作中提到】 : thanks! : so there is no way to run from command line, right?
|
c**g 发帖数: 274 | 5 No. Servlet is not POJO (Plain Old Java Object).
【在 x******o 的大作中提到】 : is there any way that I can run a servlet from command line (like run CGI from : console)? : i am new for java. : thanks,
|
c*****s 发帖数: 214 | 6 当然可以。任何java程序最终都可以(只可以)通过java命令运行
只是servlet没有main程序,
依赖别的实现,要运行需要container提供环境。启动container当然可以通过command
line了(从来不都是通过command line 的吗)。
比如 tomcat
java -cp $CATALINA_HOME/bin/bootstrap.jar
org.apache.catalina.startup.Bootstrap -Dcatalina.home=$CATALINA_HOME
-Dcatalina.base= start
CGI
【在 x******o 的大作中提到】 : thanks! : so there is no way to run from command line, right?
|
r***l 发帖数: 67 | 7 you are confusing him now. hehe
【在 c*****s 的大作中提到】 : 当然可以。任何java程序最终都可以(只可以)通过java命令运行 : 只是servlet没有main程序, : 依赖别的实现,要运行需要container提供环境。启动container当然可以通过command : line了(从来不都是通过command line 的吗)。 : 比如 tomcat : java -cp $CATALINA_HOME/bin/bootstrap.jar : org.apache.catalina.startup.Bootstrap -Dcatalina.home=$CATALINA_HOME : -Dcatalina.base= start : : CGI
|
x******o 发帖数: 31 | 8 Thank you guys! learn something new.
【在 c*****s 的大作中提到】 : 当然可以。任何java程序最终都可以(只可以)通过java命令运行 : 只是servlet没有main程序, : 依赖别的实现,要运行需要container提供环境。启动container当然可以通过command : line了(从来不都是通过command line 的吗)。 : 比如 tomcat : java -cp $CATALINA_HOME/bin/bootstrap.jar : org.apache.catalina.startup.Bootstrap -Dcatalina.home=$CATALINA_HOME : -Dcatalina.base= start : : CGI
|