ClassNotFoundException vs NoClassDefFoundError in Java

Introduction I will show an example on ClassNotFoundException vs NoClassDefFoundError. ClassNotFoundException is an exception whereas, NoClassDefFoundError is an error. I will discuss the difference between ClassNotFoundException and NoClassDefFoundError with examples.

Convert List of Map Objects Into List Of Objects Using Java Stream

Map To List Objects Here I will show you how to convert List of Map objects into List of objects using Java 8’s or later’s Stream API. The List of Map objects can be found as a result of selecting multiple records from database table or any other sources. Then you may need to convert into List of objects to…

Van Eck Sequence Using Java

Introduction The Van Eck sequence is not used for strictly research and application based professional activity. Van Eck sequence can be illustrated as follows: You start with a number 0 at the first position. Not necessarily you have to start with a 0, but you can use any integer number to start with. If you have seen the number at…

Convert Milliseconds into Years, Months, Weeks, Days, Hours, Minutes, Seconds in Java

Introduction This example shows you how to convert milliseconds into years, months, weeks, days, hours, minutes, seconds in Java. Sometimes we need to convert the milliseconds into years or months or weeks or days or hours or minutes or seconds. For example, when you want to check the exact time taken by a program to execute then you may need…

Packaging WAR, JAR modules into EAR using Maven Build Tool

Introduction Here you will see the process of packaging WAR, JAR modules into EAR file. EAR, also known as, Enterprise Archive, in which all files (.jar and .war) are packaged as JAR file with .ear (enterprise archive) extension and deployed into Application Server.

Understanding Memory Management in Java

Memory management is the process of allocating objects and removing the unused objects so that memory can be allocated for new objects. Heap and Nursery Heap is created when JVM starts up and may increase or decrease in size during application runtime. Java objects reside in the heap area. Garbage collection is run when heap area becomes full in size….

Understanding Run-Time Data Areas in Java Vitual Machine

The Java Virtual Machine (JVM) defines various run-time data areas that are used during execution of a program. Some of these data areas are created on Java Virtual Machine start-up and are destroyed only when the Java Virtual Machine exits. Other data areas are per thread. Per-thread data areas are created when a thread is created and destroyed when the…

Java Vitual Machine

Java Virtual Machine also known as JVM, is a cornerstone of Java platform. It is important platform to execute your Java applications. The first prototype implementation of JVM was created at Sun Microsystems. It was emulated in software hosted by a handled device called Personal Digital Assistant(PDA). Oracle’s current implementations emulate the JVM on mobile, desktop and server devices.

How to create HTTP Server in Java to serve Static Resources

HTTP Server Here I will show you how to create HTTP server in Java to serve static resources using sun’s HttpServer. An HTTP Server is bound to an IP address and port number and listens for incoming requests and returns responses to clients. Simple http server is flexible to be added into complex projects for rendering HTML elements or serving as…

Composition vs Aggregation explained with Java

Composition vs Aggregation explained with Java will show you what is Composition and what is Aggregation? In simple terms, both Composition and Aggregation are Associations. Composition means “Strong Has-A relationship”, whereas, Aggregation means “Weak Has-A relationship”. Composition implies a relationship where the child cannot exist independently without the parent. Example: House (parent) and Room (child). Room doesn’t exist separately without a House….