Java is one of the most used programming language in the World. The JDK comes with a lot of exciting features. In that video, we are going to use the ServerSocket and the Socket classes to create a simple HTTP Web Server in Java.

In the first part of this tutorial, we create the constants for the Web Server (index file, port, 404 file not found page, …) and the Thread which will be used to manage each client connection separately.

 

In the second part of this tutorial, we read the data sent by the client and we write the requested file on the output stream. Finally, we try our HTTP Web Server by making some requests by using Safari. Don’t hesitate if you have any question about this tutorial.

 

The complete source code of this simple HTTP Web Server made in Java can be found just below :

Don’t hesitate if you have any question about this tutorial.