53 Java libraries to solve your problems

6 minute read

Max Andersen asked something interesting over the week-end on Twitter.

What is an example of a java library that solved your problem just nicely ? Can be anything as long as available as a jar somewhere :)

Lo and behold! He received a lot of propositions. Some by very interested parties (aka ads) but hey, I left them in, I did no editorial selection. This is an interesting list of libraries to review a few at a time and might give you ideas.

I only added minor personal comments here and there but often only quoted the tagline of each project in italic.

Language

Roaster: A Java Parser library that allows easy parsing and formatting of Java source files. Roaster introduces a fluent interface to manipulate Java source files, like adding fields, methods, annotations and so on.

JavaPoet: : A Java API for generating .java source files.

Failsafe: Fault tolerance and resilience patterns for the JVM. Failsafe is a lightweight, zero-dependency library for handling failures in Java 8+. It has a concise API for handling everyday use cases and the flexibility to handle everything else. Failsafe works by wrapping executable logic with one or more resilience policies, which can be combined and composed as needed.

JCTools: Java Concurrency Tools for the JVM. This project aims to offer some concurrent data structures currently missing from the JDK.

Project Lombok: Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more.

Guava: Guava is a set of core Java libraries from Google that includes new collection types (such as multimap and multiset), immutable collections, a graph library, and utilities for concurrency, I/O, hashing, caching, primitives, strings, and more! It is widely used on most Java projects within Google, and widely used by many other companies as well.

RoaringBitmap: A better compressed bitset in Java.

JavaFX: JavaFX is an open source, next generation client application platform for desktop, mobile and embedded systems built on Java.

Vavr: Vavr *core* is a functional library for Java. It helps to reduce the amount of code and to increase the robustness. A first step towards functional programming is to start thinking in immutable values. Vavr provides immutable collections and the necessary functions and control structures to operate on these values. The results are beautiful and just work.

Base libraries

OCPsoft’s PrettyTime from JBoss alumni Lincoln Baxter: Convert Java/Android Date() objects in just “a few minutes!” PrettyTime is an OpenSource time formatting library. Completely customizable, it creates human readable, relative timestamps like those seen on Digg, Twitter, and Facebook. Get started “right now!” and in over 41 languages !

Apache Commons: a oldie but a goodie. Commons Proper is dedicated to one principal goal: creating and maintaining reusable Java components. The Commons Proper is a place for collaboration and sharing, where developers from throughout the Apache community can work together on projects to be shared by the Apache projects and Apache users. A random selection here

  • Codec: code/decode things like Base64, Hex, Phonetic and URLs
  • Collections: still useful even though Guava has a more modern approach
  • Logging: everyone has a hate love relationship with logging

Generally the Apache Commons are showing their age design wise and more modern libraries are often available.

Lightbend config: configuration library for JVM languages using HOCON files

protonpack: Stream utilities for Java 8

Scientist4J: A port of Github’s Refactoring tool Scientist in Java

Server

fluent-http: This is the simplest fastest full fledged web server we could come up with.

DeltaSpike: DeltaSpike consists of a number of portable CDI extensions that provide useful features for Java application developers. A nice addition for anyone working on CDI based servers.

Apache Kafka Streams: Kafka Streams is a client library for building applications and microservices, where the input and output data are stored in Kafka clusters. It combines the simplicity of writing and deploying standard Java and Scala applications on the client side with the benefits of Kafka’s server-side cluster technology.

Project reactor: create efficient reactive systems

Apache Camel: Camel is an Open Source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data.

Netty: Netty is an asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients.

Web

jsoup: Java HTML Parser, with the best of HTML5 DOM methods and CSS selectors.

OkHttp: OkHttp is an HTTP client that’s efficient by default.

Retrofit: A type-safe HTTP client for Android and Java.

Apache Struts: really?? Well yes it had a release in Secember 2020.

logbook: An extensible Java library for HTTP request and response logging

OmniFaces: To make JSF life easier.

Parsers and data

Apache POI: the Java API for Microsoft Documents.

tabula-java: library for extracting tables from PDF file

traprange: A Method to Extract Tabular Content from PDF Files

specification-arg-resolver: An alternative API for filtering data with Spring MVC & Spring Data JPA

GraphQL Java: GraphQL support for Java

MapStruct: Java bean mappings, the easy way! from Red Hatter Gunnar Morling and team.

jOOQ: The easiest way to write SQL in Java

caffeine: A high performance caching library for Java. Cool core cache library used by many caching frameworks.

Karate: Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework. The BDD syntax popularized by Cucumber is language-neutral, and easy for even non-programmers. Assertions and HTML reports are built-in, and you can run tests in parallel for speed.

Test

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
Nice tool to unit test with external resource dependencies.

FakeSMTP: Dummy SMTP server for developers. No update but nice to test SMTP interaction with your components.

PIT Mutation Testing: PIT is a state of the art mutation testing system, providing gold standard test coverage for Java and the jvm. It’s fast, scalable and integrates with modern test and build tooling.

Mockito framework: Tasty mocking framework for unit tests in Java

WireMock: WireMock is a simulator for HTTP-based APIs. Some might consider it a service virtualization tool or a mock server.

Awaitility: Awaitility is a small Java DSL for synchronizing asynchronous operations

XMLUnit: Unit Testing XML for Java and .NET, useful if you’re still doing XML 😂

EqualsVerifier: EqualsVerifier can be used in Java unit tests to verify whether the contract for the equals and hashCode methods is met.

AssertJ: fluent assertions java library

springfox: Automated JSON API documentation for API’s built with Spring

Tools

Jmxterm: Jmxterm is an open source command line based interactive JMX client written in Java.

docker-java: Java Docker API Client

picocli: a mighty tiny command line interface

jqwik: Property-Based Testing in Java

Others

Jenetics: Java Genetic Algorithm Library. Jenetics is a Genetic Algorithm, Evolutionary Algorithm, Genetic Programming, and Multi-objective Optimization library, written in modern-day Java.
If you need this class of algorithm,
I guess this gets you covered.

H2 Database Engine: in memory and file based RDBMS. H2, an in-memory, embedded RDBMS that has turned highly standards compliant and feature rich, perfect for a lot of vendor agnostic testing.

pac4j: security for Java

Apache Shiro: Simple. Java. Security. Powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management. With Shiro’s easy-to-understand API, you can quickly and easily secure any application – from the smallest mobile applications to the largest web and enterprise applications.

Tags:

Updated:

Comments