Step 1: Download and run the DarwinPorts Installer
Navigate to the following link and
use instructions there to accomplish the installation of DarwinPorts (MacPorts 1.7)
http://darwinports.com/download/?firstname=Ilango&lastname=Gurusamy&email=ilangocal%40gmail.com&receive_updates=1&x=69&y=14
Step 2: update the ports so that they are current on your Mac
Open a new Terminal and run the following:
sudo port -d selfupdate
Step 3: Locate Jetty
Type in the following commands:
samantha-s-imac:~ Samantha$ locate jetty
/Applications/Eclipse/plugins/org.eclipse.equinox.http.jetty_2.0.0.v20090520-1800.jar
/Applications/Eclipse/plugins/org.mortbay.jetty.server_6.1.15.v200905151201.jar
/Applications/Eclipse/plugins/org.mortbay.jetty.util_6.1.15.v200905182336.jar
/opt/local/var/macports/sources/rsync.macports.org/release/ports/www/jetty
/opt/local/var/macports/sources/rsync.macports.org/release/ports/www/jetty/Portfile
Step 4: Install Jetty
Type in the following command:
cd /opt/local/var/macports/sources/rsync.macports.org/release/ports/www/jetty
Step 4:
Type in the following command. The results of running the below command are also included
Samantha-s-imac:jetty Samantha$ sudo port install jetty
Password:
---> Computing dependencies for jetty
---> Fetching jetty
---> Attempting to fetch jetty-5.1.10-all.zip from http://superb-west.dl.sourceforge.net/jetty
---> Attempting to fetch jetty-5.1.10-all.zip from http://transact.dl.sourceforge.net/jetty
---> Verifying checksum(s) for jetty
---> Extracting jetty
---> Configuring jetty
---> Building jetty
---> Staging jetty into destroot
---> Installing jetty @5.1.10_0
---> Activating jetty @5.1.10_0
---> Cleaning jetty
Step 5: Where did DarwinPorts install Jetty?
I had no clue at first. However I drilled down to /opt/local/var/macports and
found it! It is located in the following directory:
/opt/local/var/macports/sources/rsync.macports.org/release/ports/www/jetty
Now, I am able to get to Jetty and start up the server.
Note: the 'webapps' folder is where my timeline application resides.
samantha-s-imac:jetty-5.1.10 Samantha$ ls
etc lib stop.jar
ext start.jar webapps
samantha-s-imac:jetty-5.1.10 Samantha$ pwd
/opt/local/var/macports/software/jetty/5.1.10_0/opt/local/share/java/jetty-5.1.10
Step 5: Start Jetty
samantha-s-imac:jetty-5.1.10 Samantha$ java -jar start.jar
20:02:22.460 INFO [main] org.mortbay.log.LogImpl.add(LogImpl.java:109) >16> added org.mortbay.log.OutputStreamLogSink@78ce5b1c
20:02:22.429 INFO [main] org.mortbay.util.FileResource.
20:02:22.816 INFO [main] org.mortbay.http.HttpServer.doStart(HttpServer.java:684) >10> Version Jetty/5.1.10
20:02:22.822 INFO [main] org.mortbay.util.Container.start(Container.java:74) >14> Started org.mortbay.jetty.servlet.ServletHandler@233d28e3
20:02:22.823 INFO [main] org.mortbay.util.Container.start(Container.java:74) >11> Started ServletHttpContext[/,/]
20:02:22.824 INFO [main] org.mortbay.http.SocketListener.start(SocketListener.java:204) >11> Started SocketListener on 127.0.0.1:8081
20:02:22.824 INFO [main] org.mortbay.util.Container.start(Container.java:74) >09> Started org.mortbay.jetty.Server@62587c94
20:02:22.874 INFO [main] org.mortbay.http.HttpServer.setStatsOn(HttpServer.java:1130) >18> Statistics on = false for org.mortbay.jetty.Server@c9be79a
20:02:22.875 INFO [main] org.mortbay.http.HttpServer.doStart(HttpServer.java:684) >10> Version Jetty/5.1.10
20:02:23.234 INFO [main] org.mortbay.util.Container.start(Container.java:74) >15> Started org.mortbay.jetty.servlet.WebApplicationHandler@7f712b3a
20:02:23.288 INFO [main] org.mortbay.util.Container.start(Container.java:74) >11> Started WebApplicationContext[/template,Template WebApp]
20:02:23.290 INFO [main] org.mortbay.jetty.servlet.WebApplicationContext.resolveWebApp(WebApplicationContext.java:248) >13> Extract jar:file:/opt/local/var/macports/software/jetty/5.1.10_0/opt/local/share/java/jetty-5.1.10/webapps/javadoc.war!/ to /var/folders/v9/v9F-5i-mGyqUKWHxyRLiMk+++TI/-Tmp-/Jetty__8080__javadoc/webapp
20:02:23.862 INFO [main] org.mortbay.util.Container.start(Container.java:74) >15> Started org.mortbay.jetty.servlet.WebApplicationHandler@16aeea66
20:02:23.863 INFO [main] org.mortbay.util.Container.start(Container.java:74) >11> Started WebApplicationContext[/javadoc,/javadoc]
20:02:23.914 INFO [main] org.mortbay.http.SocketListener.start(SocketListener.java:204) >11> Started SocketListener on 0.0.0.0:8080
20:02:23.915 WARN!! [main] org.mortbay.jetty.Server.main(Server.java:465) >08> EXCEPTION
org.mortbay.util.MultiException[java.io.IOException: Cannot write log directory /opt/local/var/macports/software/jetty/5.1.10_0/opt/local/share/java/jetty-5.1.10/logs]
at org.mortbay.http.HttpServer.doStart(HttpServer.java:686)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
java.io.IOException: Cannot write log directory /opt/local/var/macports/software/jetty/5.1.10_0/opt/local/share/java/jetty-5.1.10/logs
at org.mortbay.util.RolloverFileOutputStream.setFile(RolloverFileOutputStream.java:137)
at org.mortbay.util.RolloverFileOutputStream.
at org.mortbay.http.NCSARequestLog.start(NCSARequestLog.java:307)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:699)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
[0]=java.io.IOException: Cannot write log directory /opt/local/var/macports/software/jetty/5.1.10_0/opt/local/share/java/jetty-5.1.10/logs
at org.mortbay.util.RolloverFileOutputStream.setFile(RolloverFileOutputStream.java:137)
at org.mortbay.util.RolloverFileOutputStream.
at org.mortbay.http.NCSARequestLog.start(NCSARequestLog.java:307)
at org.mortbay.http.HttpServer.doStart(HttpServer.java:699)
at org.mortbay.util.Container.start(Container.java:72)
at org.mortbay.jetty.Server.main(Server.java:460)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mortbay.start.Main.invokeMain(Main.java:151)
at org.mortbay.start.Main.start(Main.java:476)
at org.mortbay.start.Main.main(Main.java:94)
Step 6: Now what?
It looks like I got Jetty running on my Mac. The next step would be to run an application inside it. Let's see how this goes.
I am not sure what those exceptions can impact anything. Stay tuned!