Tuesday, May 13, 2014

Installing the third part jar in local repository in Maven

Hello Guys, these are the simple steps of installing the 3rd party api jar in your local repository and using it in your pom.xml:


  1. You should be having the Maven already installed and configured (Link Here)
  2. In order  to check whether your maven is working or not use this command:
    • mvn --version
    • It will return the version of the Maven

After the above you can use this command to install the Jar in your local repository:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>  -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

If there's a pom-file as well, you can install it with the following command:

mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

Maven 2.5 if the JAR is built by Maven, it'll contain a pom.xml in a subfolder of the META-INF directory, which will be read by default. In that case, all you need to do is:
mvn install:install-file -Dfile=<path-to-file>

Wednesday, December 4, 2013

Uninstalling the software/plugin From Eclipse

Just few days back, I was struggling to uninstall the Software that is installed on Eclipse as a plugin or Software.

So, today I decided to write a small description about uninstalling the Software from Eclipse

Here are the steps.

(I am showing in Eclipse With Spring Source Tool Suite)

  1. Go to Help  -> About Spring Tool Suite
  2. It will popup something like this
  3. Choose Installation Details

  4. It will pop up the total software installed in your system like this

  5. Select the Entry you want to uninstall and click uninstall

And follow the wizard.


Wednesday, October 2, 2013

How Garbage Collection in Java works - (Part 1)

Hello Friends,

This is one of the most important question in almost, every interview and vivas, that what is actually a Garbage Collection means and how it works. So here is some of the information I collected from my experience.

First of all what is actually a Gargbage Collection means?
In computer science, garbage collection (GC) is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. Garbage collection was invented by John McCarthy around 1959 to solve problems in Lisp. (Wikipedia
So,ironically, Garbage Collection is a concept which says that the you just take care of creating the objects and I am  there to automatically reclaims memory for reuse, of the objects which are not required to be there in memory for future reference.
In Java,Garbage collection happens automatically during the lifetime of a java program, eliminating the need to de-allocate memory and avoiding memory leaks.

In C language, it is the programmer’s responsibility to de-allocate memory allocated dynamically using free() function.

Note : All objects are created in Heap Section of memory.

Now another question arises what are the different places in which the variables are allocated to?

Java has only two types of memory when it comes to JVM. Heap memory and Non-heap memory. All the other memory jargons we hear are logical part of either of these two.

Now, all the variables are either the part of Heap memory or Non heap memory (which can also be termed as the memory private to Object space)

Heap Memory : 
      This is the place where class variables and arrays are stored, in simple words we can say that it is the part of the memory which is shared or it is termed as shared memory, between the multiple threads.

Non Heap Memory :
      This is the place of memory where the object stores its, method definitions and constructors code with run time constants and static fields, in some of the links this area is also termed as method area.

Now when we know the basics of Java internal memory structure, there is something which also plays a vital role in the memory management, that is termed as Storage Management.

Storage management is basically a part of the Java Hotspot Virtual Machine which is sometimes used as synonym to  memory management.
But technically Storage Manager is : 
responsible for the life-cycle of Java objects: allocation of new objects, collection of unreachable objects, and notifications of unreachability if requested.

Now what is un-reachability of object means ? 
In computer science, unreachable memory is a block of memory allocated dynamically where the program that allocated the memory no longer has any reachable pointer that refers to it. Similarly, an unreachable object is a dynamically allocated object that has no reachable reference to it. Informally, unreachable memory is dynamic memory that the program can not reach directly, nor get to by starting at an object it can reach directly, and then following a chain of pointer references. (Wikipedia)

 Some of the major pillars of the Storage management are :
  1. The Klass Hierarchy
  2. Allocation
  3. Collection
  4. Generations
    1. Young
    2. Old
    3. Permanent
  5. Collectors
    1. Short Pause
    2. High Throughput
    3. Other Collector
    4. Collector Styles
    5. Parallelization Framework
  6. Notification

Tuesday, October 1, 2013

Keeping the collection of objects without using Collections or Arrays

Hey Guys,

One of my colleague asked me how can I keep a collection of Objects without using any Collection framework or Arrays and neither Maps (further more Maps are not Collections, since they never implement Collections interface)?

At first I was numb, since I am unable to think how is it possible to have a group of objects without using Collections or Arrays or Maps, then I just got an idea when we did implemented the Linked Lists using Node traversals in C Language like this,

#include <stdlib.h>

struct node {
  int x;
  struct node *next;

int main()
    /* This will be the unchanging first node */
    struct node *root;      

    /* Now root points to a node struct */
    root = malloc( sizeof(struct node) ); 

    /* The node root points to has its next pointer equal to a null pointer 
       set */
    root->next = 0;  
    /* By using the -> operator, you can modify what the node,
       a pointer, (root in this case) points to. */
    root->x = 5;     
//courtesy : Linked List in C

Using the same concept I proposed this solution, the solution is pretty much same as the concept of  C, here what I did;

public class Data{

 private int a;
 private Data next;

 public int getA() {
  return a;

 public void setA(int a) {
  this.a = a;

 public Data getNext() {
  return next;

 public void setNext(Data next) {
  this.next = next;

 public static void main(String[] args) {
  Data d1 = new Data();
  Data d2 = new Data();
  Data start = d1;
  Data startCopy = start;
   start = start.getNext();


In this way we can make a Doubly Linked List, with the functionalities like add(), next(), prev(), find(int), get(int), getFromEnd(int), getFromStart(int) and so on.

Thursday, May 10, 2012

Automatic Log Off Using JQuery

Automatic Log Off Using JQuery

Plugin : Idle Plugin

The plugin is actually created by Erich Hynds

This is one of the greatest plugin used for Automatic Logging Off the Account when the user sits idle for a couple of minutes.

Add scripts in the page, both idletimer.js and idletimeout.js

Here is the DOM structure

<div id="idletimeout">
    You will be logged off in  
    <span><!-- countdown place holder --></span> 
    &nbsp;seconds due to inactivity. 
    <a id="idletimeout-resume" href="#">
      Click here to continue using this web page 
This is the java script that is to be used for this plugin to use
$.idleTimeout('#idletimeout', '#idletimeout a', {
 idleAfter: 5,//to show the warning bar after 5 seconds
 pollingInterval: 2,//this is the time after which server url is intimated 
 keepAliveURL: 'keepalive.php', //to keep the server session alive
 serverResponseEquals: 'OK',
 onTimeout: function(){
  window.location = "timeout.htm";
 onIdle: function(){//showing the bar of warning
  $(this).slideDown(); // show the warning bar
 onCountdown: function( counter ){ //countdown timer
  $(this).find("span").html( counter ); // update the counter
 onResume: function(){ //hiding the warning bar 
  $(this).slideUp(); // hide the warning bar