Skip to main content

Network Programming in Java - #1 - Setting Up

Introduction: This tutorial is on how to begin with Networking Programming in Java. KryoNet: Kryonet is the library which I will be using for this mini series of networking programming in Java. It is a great library with easy to use functions and good error handling built in. Download: First we need to download Kryonet, to do this, go to Google and type in Kryonet and a Github link will appear (or just click hereL next click the Download ZIP button on the right hand side of the page. You will be greeted with a zip file full of the source code required. You may also need to download and install Winrar/Winzip before you are able to open the file. Installing: Now open your Java IDE, I use Eclipse - it's free, and create a new Java Project. Once you have done that, click on the java project image within your file explorer and create a new folder named "libs". Now, go to the ZIP folder you downloaded earlier and open the "build" folder, drag the entire contents in to the newly created libs folder. Ensure you click Copy Files on the prompt that shows up. Next go back to the main root folder of the ZIP file, go in to the "libs" folder and drag and drop the entire contents from there in to your libs folder also. Next, open the "src" folder within the ZIP file and copy the entire "com" folder in to your src folder that is automatically created in your Java Project - at least, it is in Eclipse. That should generate about three packages full of information. Jars: Finally we have to import the jars in to the java project, to do this right click on your java project and go to: Properties Java Build Path Libraries Add JARs Then navigate to your libs folder you created earlier and imported the JARs to from the ZIP file/folder. Select the top JAR file, hold down shift and click on the bottom JAR file to select them all, click ok and ok on the main properties window. You should now have no errors on your project and you should be ready to go to the next tutorial. See you there!

Add new comment