Java Core

CORS Filter for J2EE Application

j2ee

CORS (Cross-origin resource sharing) helps in making Javascript based AJAX request from one domain to another, requesting domain is different from the domain where the request is made. This type of request is by default forbidden at the browser level and if this type of requet is made without proper settings, they will result in some origin security policy error. ... Read More »

Exceptional Handling in Lambda expressions- Functional Programming in JAVA 8- Part 6

Java

Before reading this post kindly go from part 1 of this post to understand lambda expression. http://jkoder.com/understanding-java-8-lambda-expression-functional-programming-in-java-8-part-1/ Lambda expressions are typically inline implementation of interfaces. It basically deals with the computation part, and we all know that in real world nothing is ideal. So, we may get exceptions in our code, and lambdas are no free from exceptions. So, in ... Read More »

Using built-in Function interfaces of java.util.function pacakge in JAVA 8- Functional Programming in JAVA 8- Part 5

Java

Before reading this post kindly go from part 4 of this post to understand lambda expression. http://jkoder.com/java-7-way-vs-java-8-way-lets-get-our-hands-dirty-with-lambdas-functional-programming-in-java-8-part-4/ Previously we saw JAVA 7 way & JAVA 8 way of doing things. One thing that we feel is extra is the interface. The Condition interface has a boolean method which took in Person object. You can also rename it to “Foo”, it ... Read More »

JAVA 7 way v/s JAVA 8 way- Let’s get our hands dirty with Lambdas- Functional Programming in JAVA 8- Part 4

Java

Before reading this post kindly go from part 1 of this post to understand lambda expression. http://jkoder.com/understanding-java-8-lambda-expression-functional-programming-in-java-8-part-1/ Here we will see practical difference between JAVA 7 and JAVA 8. We will create a list of Person objects and we will do below 3 things on it first by using JAVA 7 way then by JAVA 8 way. Sort list by ... Read More »

Sample usage of Lambda Expression with Runnable interface- Functional Programming in JAVA 8- Part 3

Java

Sample usage of Lambda Expression with Runnable interface- Functional Programming in JAVA 8- Part 3 Before reading this post kindly visit from part 1 of this post to understand lambda expression. http://jkoder.com/understanding-java-8-lambda-expression-functional-programming-in-java-8-part-1/ There is no Function Type in JAVA for lambda expression types, JAVA designers reused the concept of Interface Type that is already available in JAVA. There may be ... Read More »

JAVA 8 Lambda Expression as Interface Type- Functional Programming in JAVA 8- Part 2

Java

JAVA 8 Lambda Expression as Interface Type- Functional Programming in JAVA 8- Part 2 Before reading this post kindly go through part 1 of this post to understand lambda expression. http://jkoder.com/understanding-java-8-lambda-expression-functional-programming-in-java-8-part-1/ It’s time to uncover the type of lambda expression and the execution of lambda expression. Here’s the code that we have been looking in the part-1 post. Output:- Hello ... Read More »

Understanding JAVA 8 Lambda Expression- Functional Programming in JAVA 8- Part 1

Java

Understanding JAVA 8 Lambdas- Functional Programming in JAVA 8- Part 1 Why Lambdas?….Lambdas is a new programming construct which lets you build JAVA applications in a completely different paradigm. So, what are the advantages that lambdas bring to the table:- Lambdas enables Functional programming in JAVA, it’s actually a paradigm shift from conventional Object Oriented programming. Readable and concise code ... Read More »

Generate Windows EXE installer setup/EXE executable file from executable JAR file using javapackager of JAVA8 JDK

Java

Generate Windows EXE installer setup/EXE executable file from executable JAR file using javapackager of JAVA8 JDK For all those who are dealing with executable JARs of technologies like SWING or any other standalone applications. Yup distributing files like these are very hefty jobs. Well if you are planning to distribute an installer file or executable file(Both EXE) for WINDOWS machine ... Read More »

Android Toast like message dialog in Java Swing

Java

Android Toast like message dialog in Java Swing If you are using SwingWorker background thread for doing long operations and if you want user to see some useful information then ofcourse you need to use process() function as it is invoked by Event Dispatcher Thread. But if you using JOptionPane.showMessageDialog(null, “message”); you can invoke message dialog from background worker thread. ... Read More »