How to Install Java on Windows (Step-by-Step Guide)
Learn how to install Java 21 (Oracle and Temurin) on Windows with screenshots and easy-to-follow instructions.
Learn how to install Java 21 (Oracle and Temurin) on Windows with screenshots and easy-to-follow instructions.
Learn how to integrate Flyway with Micronaut to manage database schema migrations effortlessly. This guide covers Flyway scripts, PostgreSQL, Docker, and full CRUD examples with tests.
In this article, we show how to set up and use Log4j2 for logging in a Micronaut application.
In the Micronaut CLI mn, we can use mn create-app –list-features to list all available features. Table of Contents 1. List All Feature 2. Filter Features 3. Download Source Code 4. References P.S. Tested with Micronaut 4.7.6 1. List All Feature Terminal mn create-app –list-features This will output a categorized list of features like: Terminal …
Discover how to efficiently implement logging in your Micronaut applications using default Logback framework. Logging to the console, standard files, and rolling files with practical examples.
In this tutorial, we will create a Micronaut REST API that generates and returns a ZIP file for download. Table of contents 1. Create a Micronaut Controller 2. Unit Testing the Controller 3. Run the Application 4. Download Source Code 5. References Technologies used: Java 21 Micronaut 4.7.6 Maven 3.9.6 1. Create a Micronaut Controller …
This article shows how we can compress, update, and decompress multiple files and folders into a tar.gz file using Kotlin. Table of contents: 1. Gzip vs. Java Zip 2. Add Apache Commons Compress Dependency 3. Compressing Files and Folders into a tar.gz 3.1 file name is too long (>100 bytes) 4. Decompressing a tar.gz File …
In this tutorial, we’ll explore how to create ZIP files, add multiple files and folders to a zip file, add files to an and decompress files using Kotlin. Table of contents: 1. Adding Multiple Files to a ZIP File 2. Adding Multiple Folders to a ZIP File 3. Adding Multiple Files or Directories to an …
In this tutorial, we will learn how to return a Excel file .xlsx in a Micronaut controller using Apache POI. Table of contents 1. Add Apache POI Dependency 2. Create the Excel Service 3. Create the Controller to return Excel file 4. Run the Application 5. Testing the Excel Download Endpoint 6. Download Source Code …
In this tutorial, we will create a Micronaut REST API that generates and returns a PDF file using OpenPDF. Table of contents 1. Add OpenPDF Dependency 2. Creating the PDF Controller 3. Testing the API 4. Writing Unit Tests 5. FAQs 6. Download Source Code 7. References Technologies used: Java 21 Micronaut 4.7.6 Maven 3.9.6 …
When building applications with Micronaut, we often need to execute some logic when the application starts. This could include tasks like initializing resources, seeding a database, or logging system information. In this article, we will explore how to run startup code in Micronaut using ApplicationEventListener and @EventListener. Table of contents 1. Implements ApplicationEventListener to Run …
In this tutorial, we will learn how to return JSON in a Micronaut controller using simple and practical examples. Table of contents 1. Setting Up the Micronaut Project 2. Returning a JSON Object Define a Data Model What is @Serdeable? Create a Controller Run the Application 3. Returning a List of JSON Objects Run the …
Learn how to effectively use dependency injection in Micronaut with real-world examples, covering constructor injection, multiple implementations, field injection, method injection, and unit testing.
In this tutorial, we will explore how to load an external YAML file in a Micronaut application. Table of contents 1. Why Load External Configuration Files? 2. Defining an External YAML File 3. Configuring Micronaut to Load the External YAML File Using Command Line Argument Using Environment Variable 4. Accessing Configuration Values in Micronaut Using …
When working with large files in Kotlin, handling them efficiently is crucial to avoid performance issues such as high memory usage and slow processing times. In this article, we explore different approaches to reading large files efficiently in Kotlin and compare them with Java. Table of contents Why Efficient File Reading Matters 1. Read Large …
In this article, we will cover how to read, write, modify, delete, and list files in Kotlin and compare them with Java equivalents. Table of contents 1. Reading a File in Kotlin 2. Writing to a File in Kotlin 3. Modifying a File in Kotlin 4. Deleting a File in Kotlin 5. Listing Files in …
Micronaut provides a powerful way to manage configuration using @ConfigurationProperties. This annotation allows us to bind external configuration properties (such as values from application.yml or application.properties) directly to Java objects. Table of contents 1. Setting Up the Micronaut Project 2. Defining Configuration in application.yml 3. Setting Up the Configuration 4. Injecting the Configuration into a …
Micronaut @ConfigurationBuilder allows us to bind configuration files to Java objects using builder pattern. Table of contents 1. Defining Configuration in application.yml 2. Builder Pattern 3. Using @ConfigurationBuilder 4. Injecting the Configured Database 5. Running the Application 6. Unit Tests 7. Download Source Code 8. References Technologies used: Java 21 Micronaut 4.7.6 Maven 3.x 1. …
List of the Micronaut examples, updating still in progress… 1. Getting Started Micronaut Hello World Example Micronaut @ConfigurationProperties Example Micronaut @ConfigurationBuilder Example Micronaut Loading external yaml or configuration file How to Use Dependency Injection in Micronaut Return XML in a Micronaut Controller Return JSON in a Micronaut Controller Return PDF in a Micronaut Controller Return …
Learn how to create a simple “Hello, World!” application using the Micronaut framework
Learn how to install Micronaut CLI on Windows, macOS, and Linux using SDKMAN!, Homebrew, Chocolatey, or manual installation.
Encountering a java.lang.OutOfMemoryError can be frustrating, but we can take several practical steps to prevent it. In this article, we explain what causes this error, provide real world examples, and discuss effective techniques to manage memory in our Java applications. Table of contents Understanding java.lang.OutOfMemoryError Common Causes and Prevention Techniques 1. Optimize Heap Size 2. …
In software development, a singleton is a design pattern that ensures a class has only one instance and provides a global access point to it. While implementing singletons in Java requires additional effort, Kotlin makes it simpler using the object keyword. In this article, we will learn how to create a singleton in Kotlin using …
Java remains one of the most powerful and versatile programming languages, widely used in enterprise applications, web development, microservices, and cloud-based solutions. As technology evolves, new frameworks continue to emerge, improving development efficiency, scalability, and security. In this article, we explore the top 10 Java frameworks to watch in 2025. Java Frameworks 2025 Framework Microservices …
In this tutorial, we will learn how to return XML responses in a Micronaut application using Jackson XML. Table of contents 1. Setting Up the Micronaut Project Add Jackson XML Dependency 2. Creating the XML Model 3. Creating a Controller to Return XML 4. Running and Testing the Application 5. Writing Unit Tests 6. Download …
Java application servers play a crucial role in deploying and managing Java-based applications. They provide essential features such as security, transaction management, scalability, and performance optimization. In this article, we explore the top 10 Java application servers that developers and enterprises commonly use. Java Application Servers Server Jakarta EE Support Cloud-Native Performance Scalability Use Case …
When writing Kotlin code, you should prefer using val instead of var whenever possible. This simple practice enhances code safety, improves performance, and makes your code easier to read and maintain. In this article, we’ll explore why val is preferable, how it compares to var, and provide real-world examples, including a comparison with Java. Table …
One of the most common issues in Java programming is dealing with null values, which can lead to the dreaded NullPointerException (NPE). Kotlin, however, provides built-in features to handle null safety in a more elegant way. Two of the most useful tools for this are ?. (safe call operator) and ?.let {} (scope function). In …
In this tutorial, we show how to use the Zip4j library for handling ZIP files like adding files and directories, updating existing ZIPs, password protection, and encryption. Table of Content: 1. Adding Zip4j Dependency 2. Creating a ZIP File and Adding Files 3. Adding a Directory to ZIP 4. Adding Files to an Existing ZIP …
In Kotlin, we can use the `File` built-in `exists()` method to check if a file exists.
Swapping two variables is a common task in programming. Traditionally, we use a temporary variable to hold one value while swapping, but Java allows us to swap two variables without using a temp variable. In this tutorial, we will explore different ways to achieve this in Java with real-world examples. Table of contents: 1. Swapping …
By default, a Micronaut application runs on port 8080. In this guide, we will explore multiple ways to change the default Micronaut server port. Table of Contents: 1. Changing the Server Port in application.yml 2. Changing the Server Port in application.properties 3. Setting the Port Using Environment Variables 4. Setting a Random Port 5. Download …
We can use the Java String built-in `replace()` or `replaceAll()` methods to replace spaces with dashes (`-`) easily.
In Java, we can use the Files.walk() API to traverse all files from a folder and its subfolders. Table of contents: 1. Traverse all files from a folder in Java 2. Traverse all files from a folder and its subfolders in Java 3. List all file name from a folder in Java 4. Find a …
This article shows how to pretty print JSON with JSON.simple. Table of contents: 1. Setup JSON.simple 2. Default Compact Print JSON 3. Pretty Print JSON with JSON.simple 4. Write Pretty Print JSON to a File 5. Download Source Code 6. References P.S Tested with json-simple 4.0.1 1. Setup JSON.simple pom.xml <dependency> <groupId>com.github.cliftonlabs</groupId> <artifactId>json-simple</artifactId> <version>4.0.1</version> </dependency> …
In GSON, we can use the transient keyword, ExclusionStrategy, and @Expose to exclude fields during the JSON serialization or deserialization process. Table of contents: 1. Setup Google Gson 2. Using the "transient" Keyword 3. Using the "ExclusionStrategy" 4. Using the "ExclusionStrategy" and custom annotation 5. Using the @Expose annotation 6. Download Source Code 7. References …
Gson does not directly support Java 8’s date-time APIs like LocalDate, LocalDateTime, and ZonedDateTime. However, we can create a custom JSON serializer to support Java 8 date-time types. This article shows how to use Gson to handle the LocalDate type. Table of contents: 1. Setup Google Gson 2. Default, Gson does not support Java 8 …
When the JSON field name doesn’t exactly match the Java object field names, we can use @SerializedName to change the JSON’s matching field name in Gson. Table of contents: 1. Setup Google Gson 2. JSON Unrecognized Field 3. Custom field name with @SerializedName 4. Download Source Code 5. References P.S Tested with Gson 2.10.1 1. …
This article shows how to use Gson to write a Java object to a JSON file and read that JSON file back into a Java object. Table of contents: 1. Download Google Gson 2. A Java Object 3. Write Java object to JSON file using Gson 4. Read JSON from a file using Gson 5. …
This article shows how to create a Jackson custom serializer and deserializer to parse JSON data that contains a LocalDate type. The Jackson custom serializer or deserializer is useful when we want to process a specific format that is not the default. Table of contents: 1. Setup Jackson 2. Jackson Custom Serializer for LocalDate 3. …