Java: Create Your Own Hello World Server!

Martin Ombura Jr.
Martin Ombura Jr.
Published in
8 min readMar 2, 2018

--

Java has a plethora of useful networking libraries at your disposal. In this article, I’ll show you how to make a simple Java Server, that will run on your computer. Our Server will do a few things. The moment we connect, it shall print the string “Hello!”, it shall also give us the option to terminate a connection by typing in “Peace”. The goal of this tutorial is to show you some useful Java libraries that can make this happen! When it comes to creating a server, there are really 4 mains steps to consider.

1. Create a connection that can be connected to.

Before implementing the core details of the server, we need to find a way of identifying how we shall connect to the server. This is important as it introduces three core networking concepts; ip-address, ports and sockets. Don’t be afraid of these terms, I do my best to explain them below.

IP Address — In its simplest form, an IP address is just a fancy way of representing the address of a particular computer in a network. This is represented by a particular number e.g 192.168.11.11. It is a unique id, that all other machines in the internet can identify your computer by. In our case, we will run our server on our machine, meaning the connection won’t have to go through the internet and back to our machine, instead the OS is smart enough…

--

--