JavaRush /Java Blog /Random EN /Top 10 Java Libraries to Save Time

Top 10 Java Libraries to Save Time

Published in the Random EN group
Who is this article for: some things will be of interest to beginners who are studying the Java Syntax quest, but basically the material presented will be better suited to those who have already crossed the equator of the course (understands the Java Collections and Java Multithreading quests) and is beginning to be interested in technologies that go beyond Java Core framework. Over the course of its existence, Java has acquired a fair amount of libraries. But how do you know which ones are worth using and which ones not? Separating the wheat from the chaff is extremely difficult for an ever-busy developer. In this article , Martin Patsov, Full Stack Developer at Dreamix, talks about his love for open source libraries and suggests the ones he finds particularly useful. Top 10 Java Libraries to Save Time - 1To be or not to be, that is the question: Will it turn out to be salvation or failure That same Java library... Be brave! “SigniOrs” have already been there and I will pass on their experience to you. Do not be misled by my poetic digression. There are really a lot of libraries in Java, and understanding them is oh so difficult. However, I love them very much. I can even be called a “library evangelist” ( by “evangelist” in the IT field we mean not the compiler of the canonical gospel, but someone who professionally promotes this or that technology. Do not confuse it with ordinary PR people: most often, an IT evangelist has a thorough understanding of the technology he is promoting technology - editor's note ). Libraries are a very important part of the open source ecosystem. Large communities grow around them that develop and support them. And that's great. The main advantage of libraries is that they allow us to avoid reinventing the wheel every time we write code. Use libraries—code already written for specific tasks—as often as possible! You will save time. Seriously, it's better spent hanging out with family and friends.

Top 10

In this note, I mentioned those Java libraries that I prefer to use in my work. All of them are open source software. I chose it on the basis of usefulness, good documentation and support, as well as regular updates. I would like to once again emphasize that this is my personal choice, and it may differ significantly from yours.

1. Java Standard Libraries

Yes, yes, you didn’t think so! Many people underestimate, moreover, they do not know the mass of capabilities of the Java Standard Libraries, and are not aware of how to unlock their potential in programming... or even do not use them at all. Here is a brief description of some of them:
  • java.lang . This library is always imported into any Java application, since it contains everything without which you basically cannot program ( String , Double , Enum , Math , and so on).

  • In java.util you can find all the collections and data structures available in Java.

  • Next, we have for reading files, running streams, Pipe class objects, and so on.

  • You've most likely already heard about the first three. But not everyone knows about java.nio , an alternative to This library is responsible for non-blocking I/O, allowing for, as you might guess, I/O-intensive use.

  • is used for working with sockets, creating connections or short networking applications.

  • In Java we also have libraries for working with GUI: javax.swing (a rather outdated extension of the even older java.awt ).

  • We can even play music and create MIDI files using java.sound .

2. JHipster

JHipster is a platform for quickly deploying, developing and creating scalable web servers with high load and using the most modern and fashionable technologies such as Spring, Spring-MicroServices, Netflix, Docker, Kubernetes, AngularJs, Liquibase, MongoDB, Cassandra, ElasticSearch.
Top 10 Java Libraries to Save Time - 2
Honestly, this "Java hipster" definitely saved months of my life. I can definitely say that JHipster is my personal favorite on the list and holds a special place in my heart. This tool is almost indispensable for generating a sketch of a distributed web server project. It can generate a pom file with dependencies, configure Elastic Search and Connection, all you have to do is add the business logic of the architecture. The main and most important libraries included in the generated project are:
  • Spring Boot helps speed up and simplify application development
  • Angular /AngularJS - JavaScript framework
You can find more information about JHipster here .

3. Maven

Maven is one of the three most popular tools for building Java projects. He is responsible for compiling, creating jar files (Java archives), creating a program distribution, and generating documentation.
Top 10 Java Libraries to Save Time - 3
Each modern project consists of different files, modules, technologies. To put it very simply, building a project is preparing its “working” version, that is, a program that can be launched for execution. This can be done manually, on the command line, or you can write special scripts. However, it is much easier to do this using special applications. They are called “automatic assembly systems”. Maven is one of three such programs, the other two being Gradle and Ant. Such systems receive the source code of the project as input, and as output they produce a program that can be run.
The project structure (dependencies, configurations, documentation) is described in the pom.xml file (POM - Project Object Model), which should be located in the root folder of the project. Honestly, Maven is just a great thing, even if it’s not very clear at first. If you've never used Maven before, you're missing out. Frankly, I don’t even understand how Enterprise applications were created before Maven. You can read about Maven in Russian here .

4. Apache Commons

Apache Commons is actually an entire project focused on creating Java libraries. Or “a large set of small Java utilities” for various purposes. By the way, Apache Commons utilities are the basis of several very well-known projects, for example, Tomcat, Hibernate and others. Here is a short list of some of the most commonly used Apache Commons libraries:
Top 10 Java Libraries to Save Time - 4
  • Commons Math . Apache Commons Math Library, the name says it all: it contains components for complex mathematical and statistical operations and calculations.

  • Commons CLI . Provides an API for parsing command line arguments. It’s hardly worth even thinking about creating an application without the ability to pass parameters and control its behavior!

  • Commons CSV . No matter what you develop, at some point you will have to deal with the need to use csv files. That is, they will have to be opened, read, edited, saved and created. I suggest using RFC 4180 format from the CSVFormat class and UTF-8 encoding when saving/creating files.

  • Commons I.O. Used to simplify I/O operations. At least take a look at ReversedLinesFileReader, it's worth it!
You can read about Apache Commons (in English) here .

5. Guava

Guava is a set of Google core libraries for Java. Do they contain new collection types (eg multimap and multiset), immutable collections, graph library, functional types? utilities for concurrency, I/O, hashing, string processing and much more. All these tools are used by Google specialists in their work, and this is already a good recommendation.
Top 10 Java Libraries to Save Time - 5
To some extent, Guava is an alternative to Apache Commons. In fact, we can talk about Guava for a long time (be sure to pay attention to it!), but here I will mention only one useful thing from this library. Perhaps you've already encountered the challenge of organizing your collections or comparing the contents within them? What about advanced sorting and comparison across multiple columns with multiple conditions? The ComparisonChain component is used to implement advanced and complex sorting for collections. You can read about Guava (in English) here .

6. google-gson

The google-gson library is useful for converting Java objects to JSON and vice versa. It comes in especially handy when developing mobile apps and creating/using REST APIs, or any time you need to convert a Java object to its JSON representation and vice versa.
Top 10 Java Libraries to Save Time - 6
You will learn about JSON (JavaScript Object Notation), Guava, Apache Commons and other interesting things from the Java Collections quest .
You can read about google-gson (in English) here .

7. Hibernate-ORM

Hibernate is a library designed to solve object-relational mapping (ORM) problems. Hibernate ORM is used to store data in relational databases. It provides a simpler and more abstract way for developers to do this. It uses JDBC in its implementation. Hibernate is also an implementation of the JPA specification.
Top 10 Java Libraries to Save Time - 7
You can read about Hibernate ORM (in English) here .

8. Mockito

Don't let the name Mockito fool you. This is not about a cocktail, but about a library for mock objects. Mock objects are objects that imitate the behavior of a real object according to some given scheme. For example, for unit testing, such "fake" objects can simulate the behavior of business objects. Well, the Mockito mock library increases the convenience of creating and using mock objects.
Top 10 Java Libraries to Save Time - 8
You can find information about Mockito here .

9. JUnit

JUnit is a free Java framework for creating unit tests (aka unit tests). This library is one of the most popular, almost everyone uses it. We recommend that you get to grips with it as quickly as possible, since very often new Java developers and Java Trainees are forced to “cover the code with tests.” And, I must say, this is far from the worst start to a career.
Top 10 Java Libraries to Save Time - 9
More information about Junit here .

10.Log4j and Slf4j

These two frameworks are designed to hide the implementation of routine operations for logging certain events that occur while Java applications are running. Slf4j is an abstraction for other logging frameworks (the same Log4j).
Top 10 Java Libraries to Save Time - 10
More information about Log4j and Slf4j .