One, jetty installation
From the official website download.eclipse.org/jetty/Download the required version, in the specified directory decompression can, the following with $jetty_home to represent the jetty directory, that is, the installation directory. The version I'm using is 9.2.6.v20141205.
Two, jetty start
1,jetty.sh Script Startup
In the directory $jetty_home/bin directory there is a script file jetty.sh, enter
Jetty. SH start
You can start jetty and enter localhost:8080/in your browser to get the Jetty home page. By default it is empty and you can write a index.html file yourself and place it in the $jetty_home/webapps/root/directory.
2, start with JAR file
In the directory jettypath/directory, there is a Start.jar file, enter
CD $JETTY _home
Java-jar Start.jar
You can also start jetty.
3, start jetty from the sample app
After the Jetty9.1 version, there is no longer an example in the default configuration, and if you need to see an example from JETTY, you need to start JETTY from the $jetty_home/demo-base/directory. In the shell, enter
CD $JETTY _home/demo--jar. /start.jar
At this point, enter localhost:8080/in the browser to get a welcome to Jetty home page.
4. Create a new instance directory and start
Jetty provides a feature that allows Jetty to have a separate configuration file and application directory through a new directory.
First create a new MyBase directory to start the jetty instance
mkdir-jar. /start.jar
The execution results are as follows:
-jar Start.jar [Options] [Properties] [configs] -jar start.jar--help for more Information
This should be done
Java-jar. /start.jar--add-to-startd=http,deploy
After execution, the MyBase directory will appear under the START.D and WebApps two subdirectories, that is, the generation of their own jetty instance version, again through the Start.jar boot jetty. Note that at this point, the WebApps is empty and you need to create a new Web App yourself. In addition, the resulting configuration is empty, many modules are not loaded, if it is a JSP Web page, there will be an unresolved situation.
Three, change the port
Java-jar. /start.jar jetty.port=8888
If the port number is less than 1024 (excluding 1024), the command needs to be executed as an administrator.
One, jetty start