Home >Backend Development >PHP Tutorial >How to install and configure Jetty in Linux

How to install and configure Jetty in Linux

高洛峰
高洛峰Original
2017-02-07 17:00:541892browse

Jetty is an open source servlet container that provides a running environment for Java-based web content, such as JSP and servlets. Jetty is written in Java and its API is released as a set of JAR packages. Developers can instantiate a Jetty container into an object and quickly provide network and web connections for some stand-alone Java applications. (Jetty is an open source software that can be used as an HTTP service and a container for javax.servlet.)

Steps to configure jetty server:

Create server

Configure connector

Configure handler

Configure servlet

Start server

1. Install maven

Maven is based on the Project Object Model (POM), which can be passed A software project management tool that uses short descriptions to manage project builds, reports and documentation.

If you have entered the same Ant targets ten times to compile your code, jar or war, and generate javadocs, you Be sure to ask yourself if there is a less repetitive way that does the job just as well. Maven provides such an option to shift your attention from the job layer to the project management layer. Maven projects already know how to build and bundle code, run tests, generate documentation and host project web pages.

(1) Download and compress the jdk and put it in the /usr/local directory:

[root@master ~]#chmod 755 jdk-6u5-linux-x64.bin

[root@master ~]# ./jdk-6u5-linux-x64.bin

[ root@master ~]#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

[root@ master zy]# unzip jetty-distribution-7.3.0.v20110203.zip

[root@master zy]# mv jetty-distribution-7.3.0.v20110203 /usr/local/jetty/

[root@master zy]# cd /usr/local/jetty/

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

[root@master bin]# ./jetty.sh start

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

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

(The reason for adding remote.html here is to avoid interacting with tomcat

How to install and configure Jetty in Linux

##

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn