Learn how to create and add files to a JAR programatically.
Also find me here:
Baeldung Editor
Loredana Crusoveanu
I'm a software developer specializing in back-end web development using Java and related technologies. For the past 4 years I've been working on delivering enterprise e-commerce projects.
Here's what I've reviewed (so far):
Baeldung on Java
- All
- Testing (17)
- Core Java (17)
- Java (15)
- Spring Boot (13)
- Spring (12)
- Spring MVC (8)
- Spring Data (7)
- REST (7)
- Java String (7)
- Java Dates (7)
- Data (7)
- Spring Security (6)
- Spring Cloud (6)
- Persistence (6)
- Jakarta EE (6)
- JPA (6)
- DevOps (6)
- Security (5)
- NoSQL (4)
- Java IO (4)
- IDE (4)
- HTTP Client-Side (4)
- Algorithms (4)
- Spring Web (3)
- Spring Persistence (3)
- Reactive (3)
- Maven (3)
- Java Array (3)
- Groovy (3)
- Cloud (3)
- Java Map (2)
- Java Concurrency (2)
- Java Collections (2)
- JVM (2)
- Architecture (2)
- XML (1)
- Logging (1)
- Java Streams (1)
- Java Numbers (1)
- Gradle (1)
- Artificial Intelligence (1)
JPA Support – State of the Tools Ecosystem in 2021
Filed under JPA
An overview of the JPA plugins available for IntelliJ and Eclipse
Character#isAlphabetic vs. Character#isLetter
Filed under Core Java
Understand the difference between the isAlphabetic() and isLetter() methods of the Java Character class.
Logistic Regression in Java
Filed under Artificial Intelligence
Explore the main idea behind logistic regression, and some of the available Java tools.
Guide to JUnit 4 Rules
Filed under Testing
Learn how to use the JUnit 4 Rules Model to extend the behavior of JUnit tests
Implementing the Oauth 2.0 Authorization Framework Using Jakarta EE
Filed under Jakarta EE, Security
This article shows an example of implementing the OAuth2 Authorization Framework using Java EE and MicroProfile.
Debugging with Eclipse
Filed under IDE
Have a look at some useful tips and tricks for debugging Java programs using Eclipse
Depth First Search in Java
Filed under Algorithms
A guide to the Depth-first search algorithm in Java, using both Tree and Graph data structures.
Transferring a File Through SFTP in Java
Filed under Java IO
Have a look at a few Java libraries that allow you to upload and download files through STFP.
JUnit 5 TestWatcher API
Filed under Testing
Learn how you can process the results of test method executions using the JUnit TestWatcher.
Upload and Retrieve Files Using MongoDB and Spring Boot
Filed under NoSQL, Spring Boot
Have a look at how to upload files of different sizes using Spring Boot and MongoDB.
Key Value Store with Chronicle Map
Filed under Data
Learn how to store and retrieve key-value pairs in Java using the Chronicle Map.
Check If a String Is a Valid Date in Java
Filed under Java Dates
Have a look at different ways to check if a String is a valid date in Java
JUnit 5 Temporary Directory Support
Filed under Testing
Learn how to use a temporary directory for JUnit tests, with the @TempDir annotation
Converting Iterable to Collection in Java
Filed under Java Collections
Learn how to convert an Iterable to a Collection with a core Java solution or other libraries
Geospatial Support in MongoDB
Filed under NoSQL
Have a look at how to store, index and search geospatial data with MongoDB
Double Dispatch in DDD
Filed under Persistence
Have a look at examples of double dispatch in the context of Domain-driven Design.
Removing Stopwords from a String in Java
Filed under Java String
Have a looks at ways to remove certain words from a Java String
Get the Path of the /src/test/resources Directory in JUnit
Filed under Testing
Look into different ways to find the path of the /src/test/resources directory
Mockito Strict Stubbing and The UnnecessaryStubbingException
Filed under Testing
Understand the reasons behind the Mockito UnnecessaryStubbingException and how to avoid it.
Guide to Classgraph Library
Filed under Java
Have a look at the Classgraph library, that provides APIs for analyzing the Java classpath
RestTemplate Post Request with JSON
Filed under HTTP Client-Side, REST, Spring
Learn how to use Spring’s RestTemplate to send requests with JSON content.
Guide to Google Tink
Filed under Security
Have a look at the cryptographic APIs in the Tink library, built by Google engineers
Generic Constructors in Java
Filed under Java
Learn how to use generic constructors in both generic and non-generic Java classes.
Guide to Spock Extensions
Spock’s extension mechanism allows you to hook into a spec’s lifecycle to modify its behavior
A Quick Guide To Using Cloud Foundry UAA
Learn how to use the Cloud Foundry User Account and Authentication (CF UAA) as an identity management service.
BIRT Reporting with Spring Boot
Filed under DevOps, Spring MVC
Learn how to integrate the BIRT library in a Spring Boot application to display helpful reports.
An Introduction to Refactoring with IntelliJ IDEA
Filed under IDE
Learn a few helpful tips for working more productively with IntelliJ.
The Mediator Pattern in Java
Filed under Java
Have a look at the mediator design pattern concept and Java implementation
Spring Data JPA – Derived Delete Methods
Filed under Spring Data
Learn how to define Spring Data deleteBy and removeBy methods
Getting and Verifying Response Data with REST-assured
Filed under HTTP Client-Side, REST, Spring, Testing
Have a look at how to use REST-assured to validate and extract the response from a REST endpoint
Spring Properties File Outside jar
Filed under Spring
Learn how to load Spring properties from outside the jar package
Guide to java.lang.ProcessBuilder API
Filed under Core Java
An in-depth look at using the ProcessBuilder API to manipulate OS processes
Difference Between Stub, Mock, and Spy in the Spock Framework
Understand the difference between Stubs, Mocks and Spies in Spock and how they can help to test an application
Filtering a Java Collection by a List
Filed under Java Collections
Learn different ways to filter a Collection in Java based on the values of another list
Lists in Groovy
Filed under Groovy
An overview of working with Lists in Groovy
Spring Data JPA @Modifying Annotation
Filed under Spring Data, Spring Persistence
Create DML and DDL queries in Spring Data JPA by combining the @Query and @Modifying annotations
Using WireMock Scenarios
Filed under Testing
Have a look at testing stateful APIs using WireMock Scenarios
Hibernate Query Plan Cache
Filed under Persistence
Have a look at how Hibernate’s Query Plan Cache can help improve the performance of an application.
Java Bitwise Operators
Filed under Core Java
Learn about the bitwise operators in Java and how each of them work
Conditionally Enable Scheduled Jobs in Spring
Filed under Spring
Learn different options to conditionally enable a Spring Scheduled Job
Counting Matches on a Stream Filter
Filed under Java Streams
Learn how to filter a Stream and count the matches
Common Hibernate Exceptions
Filed under Persistence
Have a look at some common errors in Hibernate and how to solve them
Create a Directory in Java
Filed under Java IO
Learn how to create directories with different structures in Java
JPA 2.2 Support for Java 8 Date/Time Types
Filed under JPA
Have a look at how to use the java.time package classes with JPA
Retrieve Fields from a Java Class Using Reflection
Filed under Core Java
Learn how to get the fields of a class using reflection, including inherited fields
Setting up Lombok with Eclipse and Intellij
Filed under IDE
Learn how to set up Lombok with popular IDEs
Kafka Connect Example with MQTT and MongoDB
Filed under Data
Have a look at a practical example using Kafka connectors.
Exclude Auto-Configuration Classes in Spring Boot Tests
Filed under Spring Boot, Testing
Learn how to disable specific auto-configuration in Spring Boot tests
Hibernate 5 Bootstrapping API
Filed under Persistence
Learn how to use the new native bootstrapping process introduced in Hibernate 5
Verbose Garbage Collection in Java
Filed under JVM
Learn how to enable verbose GC in Java and how to interpret the resulting logs.
Java 8 Predicate Chain
Filed under Core Java
Learn different ways to chain Predicates in Java
IntelliJ Debugging Tricks
Filed under IDE
Learn some helpful tricks to use when developing in IntelliJ to increase your productivity
Guide to Java Packages
Filed under Core Java
Learn about packages in Java
Introduction to RSocket
Filed under Reactive
An introduction to RSocket and the 4 interaction models it provides.
Guide to the Hibernate EntityManager
Filed under Persistence
Have a look at the EntityManager class and its use in Hibernate
Comparing Two HashMaps in Java
Filed under Java Map
Learn how to compare two HashMaps in Java as well as find the differences between them
Java Compound Operators
Filed under Core Java
Learn how compound operators work in Java
JPA Entity Graph
Filed under JPA
Load related associations using the JPA Entity Graph feature.
Customizing Authorization and Token Requests with Spring Security 5.1 Client
Filed under Spring Security
Customize OAuth2 client requests in Spring Security 5
Graphs in Java
Filed under Java
Learn about the graph data structure and how to implement it in Java
Abstract Factory Pattern in Java
Filed under Java
Understand the abstract factory design pattern along with its Java implementation.
Sorting Query Results with Spring Data
Filed under Spring Data
Learn different ways to sort results in Spring Data queries.
Fixing the JPA error “java.lang.String cannot be cast to Ljava.lang.String;”
Filed under JPA
Learn how to fix a common casting error in JPA queries.
Spring @RequestParam Annotation
Filed under Spring MVC
A detailed guide to Spring’s @RequestParam annotation
Introduction to Kafka Connectors
Filed under Data
Work with Kafka Connect to import/export data to/from Kafka topics using Connectors.
Deploy a Spring Boot Application to OpenShift
A straightforward guide on deploying a Spring Boot application to OpenShift
Convert String to Byte Array and Reverse in Java
Filed under Java String
Have a look at ways to convert between a String and a byte array in Java
Intersection Between Two Integer Arrays
Filed under Java Array
Learn how to calculate the intersection of 2 arrays using the Java Stream API.
Spring Security OAuth Login with WebFlux
Filed under HTTP Client-Side, Spring Web
Configure the OAuth Login support in a Spring Webflux application.
Convert Between java.time.Instant and java.sql.Timestamp
Filed under Java Dates
Convert a java.time.Instant to java.sql.Timestamp and vice-versa.
Lombok Builder with Custom Setter
Filed under Java
Have a look at how to use the generated Lombok Builder with a custom setter.
Microservices with Oracle Helidon
Filed under Architecture, Jakarta EE
Learn how to build microservices in Java with Oracle’s Helidon framework and its two programming models: Helidon SE and Helidon MP.
Format ZonedDateTime to String
Filed under Java Dates
Learn how to convert ZonedDateTime to String and vice-versa in Java
Introduction to Apache Pulsar
Filed under Architecture, Java
Learn about the Apache Pulsar publish-subscribe messaging system
Using JUnit 5 with Gradle
Filed under Testing
Learn how to set up and run JUnit 5 tests with Gradle.
Insertion Sort in Java
Filed under Core Java
An explanation of the insertion sort algorithm and a look at its Java implementation
Maven Polyglot
Filed under Maven
Learn how to build the POM file in different languages using Maven Polyglot
Spring Data MongoDB Transactions
Filed under NoSQL, Spring Data
Learn about transaction support in Spring Data MongoDB
A Controller, Service and DAO Example with Spring Boot and JSF
Filed under Jakarta EE, Spring
An example application of using a controller, service and DAO with JSF and Spring Boot.
Merge Sort in Java
Filed under Algorithms
Understand the merge sort algorithm and its implementation in Java
Maven Goals and Phases
Filed under Maven
Understand the concepts of Maven lifecycle, phases, goals and plugins.
A Comparison Between Spring and Spring Boot
Filed under Spring Boot
Understand the difference between Spring and Spring Boot.
Finding the Highest Value in a Java Map
Filed under Java Map
Take a look at ways to find the maximum value in a Java Map structure.
How to Separate Double into Integer and Decimal Parts
Filed under Java Numbers
Have a look at ways to separate integer and decimal parts of a double number in Java.
Find the Registered Spring Security Filters
Filed under Spring Security
Learn how to find all the registered Spring Security filters in an application.
Spring Security – Whitelist IP Range
Filed under Spring Security
Learn how to whitelist an IP range in a Spring Security configuration.
DDD Aggregates and @DomainEvents
Filed under Spring Data
Learn about Domain Events in Spring Data
Remove Emojis from a Java String
Filed under Java String
Have a look at ways to remove emojis from a text in Java
Sorting a String Alphabetically in Java
Filed under Java String
Have a look at different ways to sort a String alphabetically in Java.
Java 9 Platform Logging API
Explore the newly introduced Logging API in Java 9 along with examples that cover the most common cases.
Guide to Lucene Analyzers
Have a look at the most common Lucene Analyzers and how to use them to search and analyze text.
Maven Project with Multiple Source Directories
Filed under Maven
Configure multiple source directories in a Maven project.
Extracting Principal and Authorities using Spring Security OAuth
Filed under Spring Security
Learn how to extract user information in an OAuth setup.
Custom Validation MessageSource in Spring Boot
Filed under Spring Boot
Learn how to register a custom MessageSource for validation messages in Spring Boot.
Sample Application with Spring Boot and Vaadin
Filed under Spring Boot
Create a sample CRUD application with Spring and Vaadin.
MQTT Client in Java
Filed under Data
Learn how to use the Paho library to send an receive messages from an MQTT broker in a Java application,
Guide to Apache Avro
Filed under Data
Learn how to use the Apache Avro serialization library.
Guide to JMapper
Filed under Data
Explore the JMapper library for mapping attributes between source and destination beans.
Container Configuration in Spring Boot 2
Filed under DevOps, Spring Boot
Learn how to replace the EmbeddedServletContainerCustomizer and ConfigurableEmbeddedServletContainer classes in Spring Boot 2
Handling Errors in Spring WebFlux
Filed under Reactive, Spring Web
Have a look at different methods to gracefully handle errors in Spring Webflux.
How to Set a Header on a Response with Spring 6
Filed under Spring Web
Learn how to set a header on a specific response or on all response in Spring.
Guide to Resilience4j
Learn how to use the most useful modules from the Resilience4j library to build resilient systems.
Encrypting and Decrypting Files in Java
Use CipherInputStream and CipherOutputStream classes to encrypt and decrypt files in Java.
Using Spring ResponseEntity to Manipulate the HTTP Response
Filed under REST, Spring MVC
Learn how to manipulate the HTTP response using the ResponseEntity class.
Using Spring @ResponseStatus to Set HTTP Status Code
Filed under REST, Spring MVC
Have a look at the @ResponseStatus annotation and how to use it to set the response status code.
Create a Custom Exception in Java
Filed under Core Java
Learn how to define custom exceptions in Java.
Get Date Without Time in Java
Filed under Java Dates
Take a look at how to get a Date value without the time in Java
Convert a String to Title Case
Filed under Java String
Have a look at different ways to convert a String to title case in Java
Warning: “The type WebMvcConfigurerAdapter is deprecated”
Filed under Spring
Find out how to fix the WebMvcConfigurerAdapter warning in Spring
Convert String to Date in Java
Filed under Java Dates
Learn how to get an object representing a Date from a String in Java
Jakarta EE 8 Security API
Filed under Jakarta EE, Security
Learn how to use the Java 8 API to add security to a JEE application.
Binding a List in Thymeleaf
Filed under Spring MVC
Learn how to bind a list of objects to form input in Thymeleaf
Multi-Dimensional Arrays in Java
Filed under Java Array
Learn how to work with multi-dimensional arrays in Java
Deploy a Spring Boot App to Azure
Filed under Cloud, DevOps, Spring Boot
Have a look at the steps needed to deploy a Spring Boot app on the Azure platform.
Context Hierarchy with the Spring Boot Fluent Builder API
Filed under Spring Boot
Create a context hierarchy in Spring Boot – using the Builder API.
Optional orElse Optional
Filed under Java
Learn how to return another Optional instance if the first one is empty.
NaN in Java
Filed under Java
Understand the NaN – “not a number” value in Java.
Uploading Files with Servlets and JSP
Filed under Jakarta EE
Have a look at a file upload example with servlets and JSP.
Variable and Method Hiding in Java
Filed under Core Java
Understand the concept of hiding of variables and methods in Java.
Interoperability Between Java and Vavr
Filed under Java
Have a look at how to convert between standard Java and Vavr data structures.
Working with XML Files in Java Using DOM Parsing
Filed under XML
Learn how to parse an XML document using Xerces DOM parsing.
Spring Custom Property Editor
Filed under Spring MVC
Have a look at how you can convert between Strings and custom objects in Spring.
Composite Design Pattern in Java
Filed under Java
Have a look at how to implement the composite design pattern in Java.
Guide to DeferredResult in Spring
Filed under Spring MVC
Learn how to perform asynchronous request processing in Spring MVC using DeferredResult.
BeanNameAware and BeanFactoryAware Interfaces in Spring
Filed under Spring
Have a look at working with the BeanNameAware and BeanFactoryAware interfaces in Spring.
Projections and Excerpts in Spring Data REST
Filed under REST, Spring Data
Create custom views of entities in Spring Data REST using projections and excerpts.
Using Java Assertions
Filed under Core Java
Learn how to work with assertions in Java using the assert keyword.
How to Change the Default Port in Spring Boot
Filed under Spring Boot
Have a look at how you can change the default port in a Spring Boot application.
Service Locator Pattern and Java Implementation
Filed under Algorithms
Learn about the service locator pattern and how to implement it in Java.
A Quick Intro to the SpringBootServletInitializer
Filed under Spring Boot
Configure a Spring Boot app that’s packaged as a WAR using the SpringBootServletInitializer.
Spring MVC @PathVariable with a dot (.) gets truncated
Filed under Spring MVC
Learn how to handle path variables that contain a dot in Spring MVC request mappings.
Wrapper Classes in Java
Filed under Core Java
Have a look at wrapper classes in Java and how boxing and unboxing primitives works.
Apache Ignite with Spring Data
Filed under Spring Data, Spring Persistence
Learn how to integrate the Apache Ignite project with the Spring Data API.
EasyMock Argument Matchers
Filed under Testing
Explore argument matchers in the EasyMock library.
An Overview of the JVM Languages
Filed under JVM
A high-level look at the most popular JVM languages
Spring Boot: Customize Whitelabel Error Page
Filed under Spring Boot
Learn how to customize the default error page in a Spring Boot application.
Assert an Exception Is Thrown in JUnit 4 and 5
Filed under Testing
Have a look at how to test if an exception was thrown using JUnit.
Spring Boot Gradle Plugin
Filed under Gradle, Spring Boot
Have a look at the Spring Boot Gradle Plugin functionality that helps manage Spring Boot apps built with Gradle.
Introduction to JavaFx
Filed under Java
Explore the JavaFX library for building GUI applications in Java.
Handling Daylight Savings Time in Java
Filed under Java Dates
Learn how to account for DST in Java.
Introduction to Akka Actors in Java
Filed under Reactive
Learn how to build concurrent and distributed applications using Akka Actors in Java.
Guide to the Externalizable Interface in Java
Filed under Core Java
Have a look at Java’s Externalizable interface for custom serialization and deserialization.
Hamcrest Text Matchers
Filed under Testing
Explore Text Matchers in the Hamcrest library.
An Advanced Tagging Implementation with JPA
Filed under JPA
Take a look at more advanced tagging scenarios with JPA.
Managing EC2 Instances in Java
Filed under DevOps
Learn how to control EC2 instances using the Java SDK.
Jersey Filters and Interceptors
Filed under Jakarta EE
Take a look at how filters and interceptors work in the Jersey framework.
Guide to Inheritance in Java
Filed under Core Java
Learn about the concept of inheritance in Java.
Comparing Strings in Java
Filed under Java String
Take a look at different ways of comparing Strings in Java.
Spring Batch – Tasklets vs Chunks
Filed under Spring
Learn about the two ways to implement jobs in Spring Batch: tasklets and chunks.
An Intro to Spring Cloud Security
Filed under Spring Cloud, Spring Security
Let’s take a closer look at Spring Cloud Security features.
A Custom Spring SecurityConfigurer
Filed under Spring Security
Find out how you can add your own DSL to the Spring Security API.
Check if a String Is a Palindrome in Java
Filed under Java String
Take a look at different ways to check if a String is a palindrome in Java.
JPA Attribute Converters
Filed under JPA
Take a look at mapping JDBC types to Java classes in JPA using attribute converters.
Spring Boot Actuator
Filed under Spring Boot
A quick intro to Spring Boot Actuators – using and extending the existing ones, configuration and rolling your own.
Spring Cloud AWS – Messaging Support
Filed under Spring Cloud
A quick intro to the Spring Cloud support for AWS Messaging.
Spring Cloud AWS – RDS
Filed under Spring Cloud
A quick intro to the Spring Cloud support for AWS RDS.
Spring Cloud AWS – EC2
Filed under Spring Cloud
A quick intro to the Spring Cloud support for AWS EC2.
Spring Cloud AWS – S3
Filed under Spring Cloud
A quick intro to the Spring Cloud support for AWS S3.
Introduction to Future in Vavr
Filed under Java Concurrency
Learn about Vavr’s Future API as an alternative to the Java Future API.
Guide to ThreadLocalRandom in Java
Filed under Java Concurrency
Learn to generate random values in a multi-threaded environment using ThreadLocalRandom.
Implementing a Binary Tree in Java
Filed under Algorithms
Take a look at implementing a sorted binary tree in Java.
A Guide to Creating Objects in Java
Filed under Core Java
Take a look at the different ways to initialize primitives and objects in Java.
Java 9 Variable Handles Demystified
Filed under Java
Explore variable handles in Java 9 through the VarHandle API.
Check if a Java Array Contains a Value
Filed under Java Array
Take a look at different ways to search an array for a value.
A Guide to EclipseLink with Spring
Filed under Spring Persistence
Learn how to use Spring Data JPA with EclipseLink as the persistence provider.
A Quick Guide to Spring Cloud Consul
Filed under Spring Cloud
Learn about the Spring Cloud Consul project which provides easy integration with Consul for Spring Boot applications.
Comparator and Comparable in Java
Filed under Core Java
A quick and practical guide to Comparable and Comparator interfaces.
How to Copy a File with Java
Filed under Java IO
Take a look at some common ways of copying files in Java.
Display All Time Zones With GMT and UTC in Java
Filed under Java Dates
Take a look at displaying all time zones with GMT and UTC offsets.
A Guide to Google-Http-Client
Filed under HTTP Client-Side
Take a look at the Google HTTP Client library for accessing resources via the HTTP connection protocol in Java.
Creating a Java Compiler Plugin
Filed under Java
Find out how you can create a Java Compiler plugin.
Guide to Spring Type Conversions
Filed under Spring
Take a look at built-in type converters in Spring and how to add custom ones.
JUnit5 @RunWith
Filed under Testing
Learn how to use the @RunWith annotation in the JUnit 5 framework.
Dynamic Mapping with Hibernate
Filed under Persistence
Explore dynamic mapping capabilities of Hibernate with the @Formula, @Where, @Filter and @Any annotations.
Mocking Exception Throwing using Mockito
Filed under Testing
Learn to configure a method call to throw an exception in Mockito.
Mockito – Using Spies
Filed under Testing
Making good use of Spies in Mockito, and how spies are different from mocks.
Error Handling for REST with Spring
Exception Handling for a REST API – illustrate the new Spring recommended approach and earlier solutions.
REST Pagination in Spring
Pagination in a Spring REST Service – URI structure and best practice, Page as Resource vs Page as Representation.