title: JntelliJ can't find driver class
body: <p>I used IntelliJ IDEA 14.0, Tomcat server and h2 database to create simple Web App.
  Unfortunately when I run the application I receive message for exception </p>
  
  <blockquote>
    <p>java.lang.ClassNotFoundException: org.h2.Driver</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/7wGj6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7wGj6.png" alt="img"></a></p>
  
  <p>I stored h2 jar file in folder with name "db" and set "Add as library" function.
  I connect to the DB like this:</p>
  
  <pre><code>public class DBConn {
  
  private static final String DRIVER = "org.h2.Driver";
  private static final String URL = "jdbc:h2:tcp://localhost/~/BigPicture";
  private static final String USERNAME = "doncho";
  private static final String PASS = "";
  private static DBConn instance;
  private static Connection conn;
  
  private DBConn(){
  
  }
  
  public static DBConn getInstance(){
      if(instance == null){
          instance = new DBConn();
      }
      return instance;
  }
  
  public Connection getConnectivity(){
      try {
          Conn();
      } catch (SQLException e) {
          e.printStackTrace();
      }
      return conn;
  
  }
  
  private void Conn() throws SQLException{
      if(conn == null){
          try {
              Class.forName(DRIVER);
          } catch (ClassNotFoundException e) {
              System.out.println("No Driver Found");
              e.printStackTrace();
          }
          DriverManager.getConnection(URL, USERNAME, PASS);
      }
  }
  
  public void Disconnect(){
  
      if(conn != null){
          try {
              conn.close();
              conn = null;
          } catch (SQLException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And I call database in Servlet.</p>
  
  <pre><code>public class DBServlet extends HttpServlet {
  
  protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
      Connection conn = DBConn.getInstance().getConnectivity();
      System.out.println("It Work's");
  
      DBConn.getInstance().Disconnect();
  }
  </code></pre>
  
  <p>The Output says "No Driver Found" and throws <code>java.lang.ClassNotFoundException: org.h2.Driver.</code></p>
  
  <p>It's importand to say, that when I call class <code>DBConn</code>() in <code>Main</code> method IntelliJ fInd <code>h2</code> driver, but Tomcat still can't. </p>
  
  <p>Please help because I'm new in IntelliJ and in Eclipse this app work, but I want to use IntelliJ for my projects.</p>
  
  <p>Best regards.</p>