set PATH=%PATH%;C:\dev\bin\jruby-1.0.2\bin set JRUBY_HOME=c:\dev\bin\jruby-1.0.2 set CLASSPATH=%CLASSPATH%;C:\dev\bin\jetty-6.1.11\lib\jetty-6.1.11.jar;C:\dev\bin\jetty-6.1.11 \lib\jetty-util-6.1.11.jar;C:\dev\bin\jetty-6.1.11\lib\servlet-api-2.5-6.1.11.jar;
require 'java' include_class 'javax.servlet.ServletException' include_class 'javax.servlet.http.HttpServlet' include_class 'javax.servlet.http.HttpServletRequest' include_class 'javax.servlet.http.HttpServletResponse' include_class 'org.mortbay.jetty.Server' include_class 'org.mortbay.jetty.servlet.Context' include_class 'org.mortbay.jetty.servlet.ServletHolder' include_class 'org.mortbay.jetty.handler.AbstractHandler' class SimpleHandler < AbstractHandler def handle(target, request, response, dispatch) response.setContentType("text/html") response.setStatus(HttpServletResponse::SC_OK) response.getWriter().println("<h1>Goodbye, cruel monoglot world!</h1>") request.setHandled(true) end end handler = SimpleHandler.new server = Server.new(3000) server.setHandler(handler) server.start()
jruby jetty_example.jrb
Open a browser to this URL: http://localhost:3000/
useful links Download Jetty Download JRuby