Network Programming in Java - #1 - Setting Up

Submitted by: 
Language: 
Visitors have accessed this post 210 times.

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 https://github.com/EsotericSoftware/kryonet) 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

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.