How to install and configure jetty in Linux

Time:2021-3-2

Jetty

Jetty is an open source companyServlet container, which provides a running environment for Java based web content, such as JSP and servlet. Jetty is written in the Java language, and its API is a set ofJar package. Developers can instantiate jetty container as an object, which can quickly provide network and web connection for some stand-alone Java applications.(jetty is an open source software, which can be used as HTTP service,javax.servletIt’s a good container. )

To configure jetty server:

Create server

Configure connector

Configure handler

Configuring servlets

Start the server

1. Install Maven

Maven is a software project management tool based on the project object model (POM), which can manage the construction, report and document of a project through a small piece of description information

If you have entered the same ant targets ten times to compile your code, jar or war, and generate Javadoc, you will ask yourself whether there is a way to do the same job with less repetition. Maven offers an option to shift your attention from the operational level to the project management level. Maven project already knows how to build and bundle code, run tests, generate documents and host project web pages

(1) Download the JDK and put it in the / usr / local directory

 [[email protected] ~]#chmod 755 jdk-6u5-linux-x64.bin

[[email protected] ~]# ./jdk-6u5-linux-x64.bin

[[email protected] ~]#mv jdk1.6.0_05 /usr/local

 

Apache Maven 2.2.1 (r801777; 2009-08-07 03:16:01+0800)

Java version: 1.6.0_05

Java home: /usr/local/jdk1.6.0_05/jre

Default locale: en_US, platform encoding: UTF-8

OS name: “linux” version: “2.6.18-238.el5” arch: “amd64” Family: “unix”

2. Install and start jetty

[[email protected] zy]# unzip jetty-distribution-7.3.0.v20110203.zip

[[email protected] zy]# mv jetty-distribution-7.3.0.v20110203 /usr/local/jetty/

[[email protected] zy]# cd /usr/local/jetty/

[[email protected] jetty]# java -jar start.jar[or go to the bin directory and execute/ jetty.sh start 】

[[email protected] bin]# ./jetty.sh  start

Starting Jetty: STARTED Jetty Mon Jul 11 11:54:03 CST 2011

[[email protected] bin]# 2011-07-11 11:54:04.014:INFO::Redirecting stderr/stdout to /usr/local/jetty/logs/2011_07_11.stderrout.log

 

(add here remote.html The reason is to avoid and Tomcat

<%=”Hello World”%>

</body>

</html>

[[email protected] test1]# cd /usr/local/jetty/

[[email protected] jetty]#java -jar start.jar

2011-07-11 13:34:16.175:INFO::Deployable added: /usr/local/jetty/webapps/test1

2011-07-1113:34:16.411:INFO::started.e.j.w.WebAppContext{/test1,file:/usr/local/jetty/webapps/test1/},/usr/local/jetty/webapps/test1

In the browser, enter:

The above installation and configuration method of jetty in Linux is the whole content shared by Xiaobian. I hope it can give you a reference and support developer.