Keeps getting Class Not Found Exception for Postgres driver in eclipse plugin-Collection of common programming errors
I am developing a simple plugin for eclipse, which has one view connecting to Postgres. I have installed postgres which is running fine. I have a driver: postgresql-9.0-801.jdbc4.jar which was provided with the installation package.
Now I’m trying to connect to database using the code:
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException cnfe) {
cnfe.printStackTrace();
return false;
}
Of course, I’ve added mentioned JAR to class path: right click on project > preferences > Java Build Path It is added to “Libraries”.
Still I get an error:
java.lang.ClassNotFoundException: org.postgresql.Driver
I have also checked the box in “Order and Export” tab.
What am I doing wrong?