This is an old revision of the document!
Table of Contents
this is under construction
Setting up a simple Java Jetty Server
Java web programming includes a servlet architecture for making server applications in java and having the nitty gritty of managing the web server part of the application to a web server that functions as a servlet container. One popular embedded server for Java projects is Jetty.
You can create a java server project that embeds Jetty and run it on the MetaArray on your assigned port. Below is a very simple example on how to get started with that. It doesn't use any IDE, so it's a bit manual. You can find more detailed directions at the external project links below.
There are lots of different java frameworks that center around using the Jetty server, including a few micro frameworks. I am going to show an example using Javalin, which is a microframework that is a lighter load that Spring Boot and other more mainline frameworks. It has a simple tutorial that was used and modified a bit here to show you how to set up a Java Jetty server. To make things quick to set up, we'll use Maven (mvn
).
Create Project Space
First, we'll create your maven-style project folder.
- Go to an appropriate project folder that you want to work in
- make the java source folder in the maven style
mkdir -p src/main/java/myproject
Create Project Object Model
Next, we'll set up the POM file, which maven will use to pull all the dependencies for our framework and let us build it.