title: Error:main method not found in the class, please define the main method
body: <p>I am getting the title error while compiling my java file. But I am not getting where is my mistake..Can anyone please help me? Below is my code:  </p>
  
  <pre><code>import org.hibernate.Session;  
  import org.hibernate.SessionFactory;
  import org.hibernate.Transaction;
  import org.hibernate.cfg.Configuration;
  //imported UserDetailInfo class also here.. 
  public class UserInfo {
  
      public static void main(String[] args){
          Session session=null;
          try{
              UserDetailInfo demopojo=new UserDetailInfo();
              Configuration configuration = new Configuration();
              SessionFactory  sessionFactory = configuration.configure().buildSessionFactory();
              session = sessionFactory.openSession();
              Transaction transaction = session.beginTransaction();
              transaction.begin();
              demopojo.setId(1);
              demopojo.setFirstName("Johny");
              demopojo.setLastName("John");
              session.save(demopojo);
              transaction.commit();
  
          }catch(Exception e){
              System.out.println(e.getMessage());
          }finally{
              session.close();
          }
      }
  }
  </code></pre>