Run a JAR File From the Command Line

1. Introduction A JAR file is an archive that contains the classes and resources of a Java application. We can either treat it as a library so that...

Continue Reading

Create Executable Jar with Dependencies using Maven

1. Introduction Every Maven project includes a packaging property that specifies the artifact type like jar, war, and others. The default packaging...

Continue Reading

Thread-Safety and Sets in Java

1. Overview Java provides various Set implementations tailored for different use cases. In this tutorial, we're going to examine these Set implemen...

Continue Reading

Start Tasks Simultaneously using Java Synchronizers

1. Introduction When we execute a task using a thread pool or a dedicated thread, it runs without being aware of other threads. However, there are ...

Continue Reading

Add Multiple Resource Directories using Maven

1. Overview With the default Maven layout, we store resource files under the src/main/resources directory. After a build, Maven moves these files t...

Continue Reading

Add Multiple Source Directories using Maven

1. Overview By default, Maven uses the /project-path/src/main/java directory as the only source directory. However, in some cases, we need to defin...

Continue Reading

Mapping Immutable Types using Orika

1. Overview When using Orika, we generally map mutable JavaBean objects that contain getters and setters. But Orika also provides support to work w...

Continue Reading

Guide to JVM Shutdown

1. Overview In this tutorial, we're going to investigate the details of the JVM shutdown. Firstly we'll see in which conditions the JVM shuts down....

Continue Reading

Handling Exceptions from ExecutorService Tasks

1. Overview ExecutorService is the central mechanism to execute tasks in Java. When we run our tasks in a thread pool backed by an ExecutorService,...

Continue Reading

Mapping with Generics using Orika

1. Overview When we work with generics, Java enforces type safety only during the compilation time. At runtime, Java erases type information and we...

Continue Reading