Useful Open Source libraries for Java Programmers

Here is my collection of some of the useful third-party libraries Java developers can use in their application to do a lot of useful tasks. In order to use these libraries, Java developer should also be familiar with that and this is the whole point of this article. If you have an idea then you can research about that library and use it.

1. Logging libraries
Logging libraries are very common because you need them in every project. They are the most important thing for server-side application because logs are only placed where you can see what’s going on your application. Even though JDK ships with its own logging library, there are many better alternatives are available e.g. Log4j, SLF4j, and LogBack.

A Java developer should be familiar with pros and cons of logging library and know why using SLF4j is better than plain Log4j. 

2. JSON parsing libraries
In today’s world of web services and internet of things (IoT), JSON has become the go-to protocol to carry information from client to server. They have replaced the XML as the most preferred way to transfer information in a platform-independent way. Unfortunately JDK doesn’t have a JSON library yet but fortunately, there are many good third-party libraries which allows you to both parse and create JSON messages e.g. Jackson and Gson.

A Java web developer should be familiar with at least one of these libraries. If you want to know more about Jackson and JSON, I

3. Unit testing libraries
Unit testing is the single most important thing which separates an average developer from a good developer. Programmers often are given excuses for not writing unit tests but the most common excuse for avoiding unit testing is lack of experience and knowledge of popular unit testing library e.g. JUnit, Mockito, and PowerMock.

I have a goal in 2019 to improve my knowledge of unit testing and integration testing libraries e.g. JUnit 5, Cucumber, Robot framework etc.



4. General purpose libraries
There is a couple of very good general purpose, third-party library available to Java developer e.g. Apache Commons and Google Guava. I always include these libraries in my projects because they simplify a lot of tasks. As Joshua Bloch has rightly said in Effective Java (now the 3rd edition is also available) that there is no point in re-inventing the wheels and we should prefer using tried and tested libraries instead of writing our own routines every now and then.

It’s just for a good Java developer to get himself familiar with Google’s Guava and Apache commons library.

5. Http libraries
One thing I don’t like much about JDK is their lack of support for HTTP. Though you can make HTTP connection using classes in java.net package it’s not as easy and seamless as by using open source, third-party libraries like Apache HttpClient and HttpCore.

Though JDK 9 is bringing the support of HTTP 2.0 and better support for HTTP, I strongly suggest all Java developers get familiar with popular HTTP client libraries e.g. HttpClient and HttpCore.

 

6. XML parsing libraries
There are many XML parsing libraries exists e.g. Xerces, JAXB, JAXP, Dom4j, Xstream etc. Xerces2 is the next generation of high performance, fully compliant XML parsers in the Apache Xerces family. This new version of Xerces introduces the Xerces Native Interface (XNI), a complete framework for building parser components and configurations that is extremely modular and easy to program.

The Apache Xerces2 parser is the reference implementation of XNI but other parser components, configurations, and parsers can be written using the Xerces Native Interface. Dom4j is another flexible XML framework for Java application. 

7. Excel reading libraries
Believe it or not but all real-world application has to interact with Microsoft office in some form or other. Many application needs to provide functionality to export data in Excel and if you have to do same from your Java application then you need Apache POI API.

This is a very rich library which allows you to both read and write XLS files from Java program. You can see that link for a working example of reading Excel file in Core Java application.

8. Bytecode libraries
If you are writing framework or libraries which generate code or interact with bytecodes then you need a bytecode library. They allow you to read and modify bytecode generated by an application. Some of the popular bytecode libraries in Java world are javassist and Cglib Nodep.

The Javassist (JAVA programming ASSISTant) makes Java bytecode manipulation very simple. It is a class library for editing bytecodes in Java. ASM is another useful bytecode editing library.

 

Related blog:

 

Java course training in chennai