Thursday, September 11, 2014

How to Install Git Plugin in Eclipse Using EGit

This is very easy and you can do this easily. Normally , Eclipse IDE usually comes with Git integration through EGit. But, some how if its missed, we can add as the external plugin. Follow the below step-by-step process .

Step by step process to install git  plugin on eclipse:-

Step 1) Use the repository location. i.e. http://download.eclipse.org/egit/updates

Step 2.) Go to Help > Install New Software

Step 3.) Add repository location, Click Add. Enter repository name as "EGit". Then click Ok to add repository location.

Step 4.) Expand “Eclipse Git Team Provider” and select “Eclipse Git Team Provider”. Then Click Next

Step 5.) Review product and click Next.

Step 6.) Accept the agreement and click Finish.

Step 7.) Then, it will take few time for download the plugin and binaries.

Step 8.) Then ,accept the prompt to restart the Eclipse.

Now Your Eclipse is ready to use Git Repository Plugin.

You can also verify the Git installation.

Step 1.) Go to Help > Install New Software

Step 2.) Click on Already Installed and verify plugin is installed.

Else you can verify by searching on Windows => preference => type egit on search box.
















Java Command Not Working from Command Prompt in Windows

This issue I faced with window 8. When I was trying to execute java command from command prompt it was showing this error.After long time analysis I found the reason for this issue. This issue is really ambiguous.Its normally a path issue, if your class path has configured proper and still its not working then it might be a big reason to worry.

Solutions 1 :- Check your class path , if not set then use the below command to set.

path = your_java_installation_bin_path; 

Solutions 2 :- Probably there is few more java.exe file in your windows directory (i.e. C:\) .Normally when windows automatic updates works on your machine it may be install java into some other reference directory and it may be the cause.So, when you are trying to execute the java command from command prompt its not able to locate the exact path . 
 
As a solution , I have done this by removing all the java.exe files from windows directory.

You can search the java.exe file from windows directory and remove all java application files , except your own java installation directory. After removing all those extra java application files its working fine for me. Below the screen shot for finding and removing the java application file.





How to Set Java Library Path in NetBeans IDE

This issue has wasted my 2 days of time. Setting java library class path on NetBean IDE is bit tricky.
Finally I found and its working now. Some little bit setting you have to do with your NetBean IDE.This setup is only for NetBean IDE.

Follow the Steps :-

==>Right click on the Project
==>Properties
==>Click on RUN
==>VM Options : -Djava.library.path="C:\Your Directory where Dll is present"
==>Ok


Its working 100%. I have done this in my own project settings.

Saturday, August 9, 2014

Experienced Java Interview questions asked by CGI

3+ Year experienced java questions asked by CGI.

       1)  Tell me about your self ?

    Ans : Just describe yourself with cool & confidence.
    
2) What you know about our company?

   Ans : Remember , it’s a very crucial question. You must do one R&D before going to interview. You should know about their product, technical stuffs they are working, market value of the company and other important stuffs.

3) What is transient variable ?

   Ans : Transient variables are not serializable. It helps to avoid a variable to being serialization.

4) Write the code to initialize the inner class members.

Ans : Code here

public class InnerClassTest {

      class innerTest{
            private int age;
           
            public void display(){
                  System.out.println("Age="+age);
            }
      }
      /**
       * @param args
       */
      public static void main(String[] args) {
            InnerClassTest.innerTest innerObj=new InnerClassTest().new innerTest();
            innerObj.age=20;
            innerObj.display();
      }
}
 5) How to retrieve the elements from the collection write the code ?

Ans : Java provides certain interfaces by using that we can retrieve the elements from collection.Example – Iterator, ListIterator and Enumeration.

Example :- ArrayList data retrival

public class ArrayListRetrive {

      /**
       * @param args
       */
      public static void main(String[] args) {
            ArrayList<String> arList=new ArrayList<String>();
            arList.add("Java");
            arList.add("is");
            arList.add("Powerful!!!");
           
            //Retrive elements from ArrayList using Iterator
            Iterator iTer=arList.iterator();
            while(iTer.hasNext()){
                  System.out.println(iTer.next());
            }
      }

}
6) What is static and instance variables and methods ?

Ans : Static variables are per class but the instance variables are per object. All object share a single copy of static variable. In case of static method , no need of object creation for calling static method. The static method can directly call by using class name. Instance method need object for calling.
7) What is dynamic loading and static loading of java class ?

Ans : Dynamic class loading is by Class.forName() , which loads the class dynamically. Also you can use reflection for dynamic class loading. But, the static class loading is working by using ‘new’ keyword.

8) What type of loading is class.forname() ?

Ans : Its dynamically locate and loads the class.

9) What is Hibernate 3 best benefits ?

Ans : There are many benefits of hibernate. But the most benefits are below :-

1.     It reduces the developer effort to writing queries.
2.     Its easy to use with relational object which maps with java class and database relation.
3.     Query tuning is not required and it implements separates cache which is reason for better performance.

10) I have 100 tables and fields. I want to find one table name and  column names.  Write a quey .

Ans :  I have used MySQL database for this below query.
select TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME from information_schema.COLUMNS where TABLE_NAME='EMPLOYEE';

 11) How to define a field name in hibernate using annotation ?


          Ans:- @Column  (Its provided by java persistent  API).

 12) What is Synchronization ?

          Ans:- Synchronization is a solution for concurrency issue. Java provide 'synchronized' keyword for implementing this.

  13) The most commonly used classes in collections ?

Ans : ArrayList, LinkedList, HashTable, HashMap and ConcurrentHashMap, etc.