[Solved] validation errors for already well tested third party JavaScript libraries

Problem : Sometimes Eclipse gives validation errors for already well tested third party javascript libraries while you build your code.

Solution :

Step 1 :

Right click on the project ->Properties->JavaScript->Include path.


Step 2 : 

Select Excluded under Source tab by clicking on it.


Step 3 :

Click on Edit… button.


Step 4 :

Click on “Add Multiple…” button in Exclusion pattern section and select java script files which are giving errors and for which you don’t want  validation to happen, from Your project’s folder.
Click ok.

Step 5 :

You will see all the selected scripts in exclusion patterns as below .Click on Finish.


Step 6 : 

Click Ok on below popup.



Clean build the project again and your validation errors will be gone.

Thanks.

[Solved] There are No resources that can be added or removed from the server - Tomcat

Issue : User created a dynamic web project in Eclipse and then try to deploy it on embedded Tomcat in eclipse by right clicking on server and clicking on "Add and Remove..." option.

User gets message "There are No resources that can be added or removed from the server"

Solution :

Right click on project -> Properties->Type "Project Facets"-> Select "Project Facets" -> tick Dynamic Web Module checkbox -> Select appropriate version -> Click Apply.


Now again right click on server and select "Add and Remove..." option,you should be able to deploy project as can be seen in below screenshot.


Thanks for reading!!!!

How to Install SVN Plugin in Eclipse

Hi Friends,
In this tutorial we will see how to install SVN plugin in eclipse.
Prerequisite : You should have internet connection.
Steps :

It is a two step process:

Step 1 : Install Subversive Plugin
Step 2 : Install SVN Connector

Step 1 : Install Subversive Plugin
1) Open eclipse 
2) Go to Help menu option -->install new software and click on install new software.
  
3) Click add button in front of work with drop down.
   
4) In the opened pop up,give any name in "Name" textbox and in "Location" textbox enter following url:
    and click ok.

   Note : Visit https://eclipse.org/subversive/downloads.php for latest subversive release.
   
5) Wait for some time it will search for plugins.Select required plugin(s),click next,next and finish and it      will install required plugins.
6) It will ask for restart.Restart Eclipse.

Step 2 : Install SVN Connector

7) Once you have installed subversive plugin and you restart eclipse,subversive will automatically show the dialog that shows Subversive SVN Connectors compatible with the installed version of the plug-in.I selected Native JavaHL 1.8.15 and installed it.
8) Go to Windows -> Show View -> type SVN and select SVN Repositories
   
8) You will find SVN Repositories tab in eclipse as can be seen in below screenshot

9) You can create a new repository location in the above mentioned tab by right clicking and then selecting New->Repository Location.. and then by entering required SVN URL along with username/password.

Additional Tips 

1) You can download SVN Connector by going to Window->Preferences->SVN->SVN Connector as well.
OR
2) You can download SVN Connector by going to Help-> Install New Software...->Get latest and compatible(with Subversive and OS) Url from  https://www.polarion.com/products/svn/subversive/download and enter in Work With box and click add and then procedd with installation just like you did for subversive above.

That's all.With this we saw that how we can add SVN plugin in eclipse.
If you have any suggestion to add something more to this post,please post in comments section.

Can we overload or override main method in Java

Hello Friends,

In this tutorial,we will see whether we can overload or override main method in Java.This is very common interview question as well and the answer is really simple,if we don't overthink :)


To understand What is main method and what it does thoroughly,please read What does main method do in Java? Why main method is public,static,void?

Can we overload main method in Java?

Short answer is YES,we can overload main method in Java.

main method's specialty is that it provides starting point for a standalone java application.It's signature is such that JVM understands that signature and calls main method with specific signature.

main method signature is as follows :
public static void main( String[] args );

which means if we define another method in same class with another signature,JVM will still call main method with above mentioned signature only.
So it is perfectly fine to have another main method in same class with different signature and we very well know that methods with same name and different signatures within a class are known as overloads.

Let us see it working with example.
public class Application {
    public static void main( String[] args )
    {
        System.out.println( "In JVM called main method" );
        System.out.println("Before calling overloaded main method");
        System.out.println("Result of calling overloaded main method from JVM called" + 
           "main method:"+main(10,20));
    }
    public static int main(int a,int b){
        System.out.println( "In overloaded main method" );
        return a + b;
    }
}
Output :
In JVM called main method
Before calling overloaded main method
In overloaded main method
Result of Calling overloaded main method from JVM called main method:30

So we can see from above example that 
- When we ran Application.java ,JVM called main method with following signature only
   public static void main( String[] args );
- We can have overloaded version of main method also.Here we had overloaded main             method with following signature
  public static int main(int a,int b);
- We can call overloaded main method just like any other method.In our example we called      overloaded main method from JVM called main method as below
  System.out.println("Result of calling overloaded main method from JVM called""main method:"+main(10,20));

So with this we learnt that main method just like any other method can be overloaded.Now let us see whether it is possible to override main method in java.

Can we override main method in java ?

Short answer is NO,we can not override main method in java.
Reason is very simple.As main method is static and we know very well that we can not override static methods in Java,hence main method could not be overridden. So what will happen if we will try to override main method in subclass.

Let us see with an example 
public class Application {
    public static void main( String[] args )    {
        System.out.println("Application class main method");
    }
}
public class AnotherApp extends Application{
   public static void main(String[] args) {
  System.out.println("AnotherApp main method");
   }
}
public class TestClass {
    public static void main(String[] args) {
  Application application = new Application();
  application.main(new String[1]);
  Application application1 = new AnotherApp();
  application1.main(new String[1]);
 }
}
Output :
Application class main method
Application class main method

So we can see from above example that 
- We defined main method in Application.java
- AnotherApp class extended Application class
- AnotherApp class also defined main method with exactly same signature.But we should note here
  that main method defined here in AnotherApp class is just another method and it is not a overriding
  Application class's main method.
- To prove that main method of AnotherApp is not overriding Application class's main method,we created
  TestClass,in which we tried to call main method's of Application and AnotherApp polymorphically as below
 Application application = new Application();
 application.main(new String[1]);
  
Application application1 = new AnotherApp();

 // In case main method would have overridden,main method of AnotherApp would have got called through below method call.
    application1.main(new String[1]);

But as we can see in output ,in both calls ,main method of Application class is called.

So with this we learnt that main method can be overloaded but can not be overridden in Java.

If you have any comment on the post,please post in comments section.

Thanks for reading!!!