BACK |
INDEX |
EXIT |
NEXT |
The start.jar file in the Jetty distribution may be run with
java -jar start.jarFor example...
java -jar start.jar etc/admin.xml etc/demo.xmlOn some systems with graphical file browsers, it may be possible to start jetty by double clicking on this jar file. For more details see
$JETTY_HOME/src/org/mortbay/start/README.txt or http://jetty.mortbay.org/javadoc/org/mortbay/start/Main.htmlIf jetty is not being started from the current directory, then the jetty.home property should be set:
java -Djetty.home=C:\jetty -jar start.jarIf JSPs do not work with this start method, you may want to clearly specify the location of the JDK so the compiler can be accessed:...
java -Djava.home=C:\j2sdk1.4.1 -jar start.jarIf an extra classpaths are needed, they can be added with the jetty.class.path property:...
java -Djetty.class.path=/usr/share/java -jar start.jarIf no configuration file is provided, start.jar will use etc/admin.xml and etc/jetty.xml...
Stopping Jetty
Programs started with the start.jar mechanism may be stopped with the stop.jar:
java -jar stop.jarThis connects via a local port to stop the server. The default port can be set wi th the STOP.PORT system property (a port of < 0 disables the stop mechanism). If the STOP.KEY system property is set, then a random key is generated and written to stdout. This key must be passed to the stop.jar. eg
[540] java -DSTOP.PORT=9999 -DSTOP.KEY -jar start.jar 1rukbu7owi3uo 17:39:49.082 EVENT Starting Jetty/4.2.10pre0 ... [526] java -DSTOP.PORT=9999 -DSTOP.KEY=1rukbu7owi3uo -jar stop.jar
export JETTY_HOME=<jetty install directory>Running a simple server
$JETTY_HOME/bin/jetty.sh run
http://localhost:8080If the script doesn't work for you, either try the Ant version, or follow the manual instructions .
$JETTY_HOME/bin/jetty.sh demoUse your browser to go to the following location:
http://localhost:8080Select the Demonstrations link to explore the servlets provided. Here is page you should see.
set JETTY_HOME=<jetty install directory>Running a simple server
%JETTY_HOME%\bin\jetty.batUse your browser to go to the following location:
http://localhost:8080If you have problems:
%JETTY_HOME%\bin\jetty.bat demoUse your browser to go to the following location:
http://localhost:8080Select the Demonstrations link to explore the servlets provided. Here is page you should see.
Running a simple server
To verify Jetty on your system, type the following command to start a very simple one-page server:
Unix:To view the demo, use your browser to browse toant run
Windows:ant.bat run
http://localhost:8080
Running the Jetty demonstrations
To run the more sophisticated servlet demonstrations, execute the following command (if you are still running the previous example, don't forget to kill it first):
Unix:To view the demonstrations, use your browser to go toant demo
Windows:ant.bat demo
http://localhost:8080
and select the Demonstrations
link to explore the servlets provided.
This is the page you should see.
Running with JMX enabled
To run Jetty with JMX instrumentation, execute:
Unix:ant demo.jmx
Windows:ant.bat demo.jmx
> http://localhost:8082
CLASSPATH=\
$JETTY_HOME/lib/org.mortbay.jetty.jar:\
$JETTY_HOME/lib/javax.servlet.jar:\
$JETTY_HOME/ext/jasper-runtime.jar:\
$JETTY_HOME/ext/jasper-compiler.jar:\
$JETTY_HOME/ext/xercesImpl.jar
For jdk1.2 or jdk1.3 us the following classpath, you need to use the
alternative jetty jars and add the XML support. Thus the classpath
to use is:
CLASSPATH=\
$JETTY_HOME/lib/org.mortbay.jetty-jdk1.2.jar:\
$JETTY_HOME/lib/javax.servlet.jar:\
$JETTY_HOME/ext/jasper-runtime.jar:\
$JETTY_HOME/ext/jasper-compiler.jar:\
$JETTY_HOME/ext/xercesImpl.jar:\
$JETTY_HOME/ext/xml-apis.jar:\
$JETTY_HOME/ext/xmlParserAPIs.jar
To use SSL you will also need to add the the jars below: (see here for more details):
$JETTY_HOME/ext/jnet.jar (not needed for JDK1.4.1)
$JETTY_HOME/ext/jcert.jar
$JETTY_HOME/ext/jsse.jar
$JETTY_HOME/ext/mx4j.jar
$JETTY_HOME/ext/mx4j-tools.jar
For java >=1.5 you will also need to add
-Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder
to the command line to avoid a clash with the internal jmx implementation.
To run JSP with the JDK compiler, you will also need to add the JDK tools.jar
jar, and the ant.jar file from jakarta-ant 1.5 or later.
Execution
The execution examples are illustrated using Unix-style commands
and environment variable specifications - adapt these as necessary to
your environment.
To run a Jetty server, the steps are:
cd $JETTY_HOME
java org.mortbay.jetty.Server <xml configuration file>
The <xml configuration
file> specifies the operation of the Jetty server. Some
examples of these can be found in the
$JETTY_HOME/etc directory.
For example, the simple one-page server mentioned in the Quick Start
sections can be started by the following command:
cd $JETTY_HOMEThe servlet demonstration server is run by the following:
java org.mortbay.jetty.Server etc/jetty.xml
cd $JETTY_HOME
java org.mortbay.jetty.Server etc/admin.xml etc/demo.xml
BACK |
INDEX |
EXIT |
NEXT |