1. First download the latest jetty from Jetty's official website http://download.eclipse.org/jetty/, download the corresponding jetty according to the JDK version, I chose the jetty-distribution-9.2.14.v20151106 version here.
2. Unzip the package to the specified directory, I unzip to the E:/jetty directory
3. Try to start the service
Jetty Boot is different from Tomcat, we know that there is a startup.bat file in the bin directory of Tomcat and we just double-click it and Tomcat starts. However, the Jetty Bin directory does not have such a boot file. So how do we start? Run the cmd command into the DOS environment
- Then run "Java-jar Start.jar" and you can start jetty server.
- Open the browser, visit http://127.0.0.1:8080, you can see the Jetty Welcome page.
4. Introduction to the jetty directory, like the Tomcat container, we also need to know what each directory does
Directory |
Description |
Bin |
Jetty command, you can configure jetty as a system service |
Ect |
Jetty Self-configuration files |
Lib |
Jar file for Jetty |
Logs |
Jetty log files at runtime |
WebApps |
For web apps, jetty will automatically load all Web apps in this directory |
Start.jar |
The startup file for the jetty. Start jetty with Java-jar Start.jar in the command line environment |
5. About the configuration instructions "a little bit of effort"
- Through the above directory we already know that all the configuration files are placed into the E:/JETTY/ETC directory
- Through the E:/jetty/etc/jetty-webapps.xml file, you can see that all Web apps are placed in the E:/jetty/webapps directory by default in jetty; ( note : The 9.x version is {jetty_ Home}/etc/webdefault.xml), did not modify the contents of this area too much.
- We can modify the port number of the jetty like Tomcat, the earlier version is modified in Jetty.xml, but the Jetty9 port modification is to modify the Start.ini file under the root directory
Modify the Start.ini file jetty.port=8001 position on line 105th |
by command mode: Java-jar Start.jar jetty.port=8081 |
6. Questions relating to access
http://127.0.0.1:8080, this time note, probably nothing after the visit, before the 9.1 version of jetty in the default release of WebApps is the demo, but after 9 version is not.
Since the 9.1 release, the jetty distribution has not deployed any demo Web applications, so see more demo servers that need to run from the Demo-base directory as follows: Launch jetty Base-demo, can be launched as a jetty demo project
The browser points to http://localhost:8002 and now displays the Welcome page and several demo/test Web applications.
7. Simply try to publish your project and start Jetty,e:\jetty>java-jar Start.jar jetty.port=8002
Jetty 9 Actual Installation/operation/deployment