This is a little webserver I wrote in Java. I wanted to embed a webserver into one of my other Java projects to save creating a thick GUI in Swing. This webserver is the result. It can also be used ’standalone’ to serve files from your hard-disk, for sharing or transfering stuff to other people. When used standalone it only requires one file JAR to use and it can be started by simply double-clicking the JAR.
Update - well I should have had a look round the web before I spent time writing this as Jetty is what I should have used - ohh well! I learnt a lot about the internal workings of HTTP. In fact looking round the Jetty javadoc you’d have thought that I copied them given some of the main class names are the same - well I didn’t (in case you were wondering!) I’m leaving this up here for the curious, it’s not that my attempt is bad, just that Jetty is MUCH fuller featured
Download
Documentation
1) To run as a standalone webserver simply copy the JAR file to where the directory where you want to serve files from, then double click the JAR file - easy as that! When it’s started a dialog should POP-up telling you the URL to access your web server
The ‘server.properties‘ file can be used to change the server settings but if it’s missing then the server runs with it’s internal defaults so it’s not required for the server to run. The default settings are
- http_tcp_port = 1975
- http_doc_root =
- http_log_dir = ‘HTTP-logs/’
- http_log_level = ‘CONFIG’
- http_log_size = 1000000
- http_log_count = 5
- http_ka_enable = true
- http_ka_time = 15
2) Use the HTTPServer class in your own code to embed a HTTP server into your own Java project. Include the JAR file in your classpath and see the javadoc for more details on using the server.
Java Documentation
Click here for the HTTPServer package javadocs and API reference
License
This software is distributed freely under the GPL license
see http://www.gnu.org/licenses/gpl.html for details.



I’m taking Java in my school but I get confused easilly. How do these people program games like runescape, it would take forever!