---
title: "Jetty学习笔记1（简介,运行,部署）"
author: "fanjf2012"
date: "2014-03-06T11:05:49Z"
tags: []
categories: ["开源软件"]
slug: "jetty-1"
draft: false
lastmod: "2014-03-06T11:05:49Z"
id: 2026480
url: "https://fanjf2012.iteye.com/blog/2026480"
---

#### Jetty介绍

Jetty is an open-source project providing an HTTP server, HTTP client, and javax.servlet container.jetty9要求 jvm1.7，Servlet；jetty8要求1.6，Servlet3.0；jetty7要求1.5，Servlet2.5；下载jdk7官网下载慢可以搜索通过百度网盘；jeety官方文档[http://www.eclipse.org/jetty/documentation/current/index.html](http://www.eclipse.org/jetty/documentation/current/index.html)

#### Running Jetty：

特别说明：由于本人机器之前一直用jdk1.6,jetty8直接运行就可以了&gt; cd $JETTY\_HOME  &gt; java -jar start.jar  访问： [http://localhost:8080，jetty9需要jdk1.7](http://localhost:8080%EF%BC%8Cjetty9%E9%9C%80%E8%A6%81jdk1.7)一定要安装，环境变量没有必要重新设置(注：此处错误，JDK默认拷贝java.exe 到文件中C:\\WINDOWS\\system32\\java.exe，不需要配置path，但是后期部署应用会出问题)。&gt; cd $JETTY\_HOME/demo-base/ &gt; java -jar ../start.jar 才能访问: [http://localhost:8080](http://localhost:8080/)

Jetty9的介绍: The Jetty project is a 100% Java [Servlet](http://en.wikipedia.org/wiki/Java_Servlet) Container which supports asynchronous server and client implementations of the[HTTP](http://en.wikipedia.org/wiki/HTTP), [Websocket](http://en.wikipedia.org/wiki/WebSocket) and [SPDY](http://en.wikipedia.org/wiki/SPDY) protocols. The project is 100% [Open Source](http://en.wikipedia.org/wiki/Open_source) and hosted by the [Eclipse Foundation](http://www.eclipse.org/) at[http://www.eclipse.org/jetty](http://www.eclipse.org/jetty/).

默认端口修改文件;`start.ini` file and `start.d/*.ini` files.如：demo-base\\start.d\\http.ini中

#### 部署web应用

直接将应用部署到%JETTY\_HOME%/webapps

报错：PWC6345: There is an error in invoking javac.  A full JDK (not just JRE)解决方案：删除 C:\\WINDOWS\\system32\\java.exe 重启jetty

此时jetty9无法启动，原因是系统中的java.exe是在安装jdk时候自己copy一份的，删除此处，需要在path中配置%java\_home%\\bin