How to install Maven on Windows

In this tutorial we will show how to install the maven on windows. Installation tools Windows 10 Java 1.8 Maven 3 Steps for Installation 1. Download Maven Download the latest maven zip file from Apache Maven website.  For this tutorial we are going to download apache-maven-3.3.9-bin.zip. Let’s unzip this zip file to a folder maven C:\DeveloperTools\maven3 Here … [Read more…]

Java web crawler

Crawler Introduction

In this tutorial, you will learn how to crawl a website using java. Before we start to write java web crawler we will see how a simple web crawler is designed. What is a crawler? A web crawler is a program that browses the World Wide Web. Web crawlers are also known as spiders, bots and  automatic … [Read more…]

extundelete, Recover deleted files in Ubuntu

Download and make extundelete Run this script to download and compile extundelete from source Recover Files Get drive name Now that the extundelete is compiled, you would need to check the name of the drive to recover. And that can done by: Restore Restore all Restore a directory Restore a directory after a date/time In … [Read more…]

How to refactor enum to class

In this tutorial we will see how to refactor an enum.  I was recently working on a small project that was using an enum to manage some constants. But we had to change this enum to a class due to change of requirements. Overview Let’s say that a project was allowing users to choose from … [Read more…]

Compress and decompress byte[] in java

Here is a simple utility that compresses and decompresses a byte[] array. I have been using this utility to compress serialized objects before storing to and after retrieving them from the database. I have found it very useful. I have added a main method to just show that how the compression works. output: For more … [Read more…]

Convert int[] to Integer[] and vice versa in java

Here is a simple example to convert primitive int array to Integer array and vice versa Using regular for-loop And the output is : Java 8 Using Stream APIs of Java 8. Commons Arrayutils If you are not using java 8 and still want to have a oneliner. Use ArrayUtils from commons-lang3. References http://www.oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html https://en.wikipedia.org/wiki/Primitive_wrapper_class … [Read more…]

JavaFx Helloworld

In this example we will create a simple Helloworld application for JavaFx. I have added inline comments to the code. And here is the output   Notes In case you are using this HelloWorld in eclipse and you get the below warning. Access restriction: The type Pane is not accessible due to restriction on required … [Read more…]

Distribute your code in a unique style

So let’s have a look at a very interesting way of loading a class. UnIntrestingClass.java We have a very simple class. There is nothing special about it. It just prints text in constructor. ByteCodeGenerator.java This class prints the bytecode of the UnIntrestingClass. This class just shows how to print the bytecode. It prints InterestingLoadClass.java Let … [Read more…]