netbeans - java.lang.ClassNotFoundException: org.postgresql.Driver -


Whenever I create my project as a jar (via netbans), it seems like postgrescale driver The library is not included. I should remember this before having any problems with the previous versions of Netbeans and drivers. I run something like CMD:

  c: \ user \ user name> java -jar "c: \ user \ username \ document \ netbusiness project \ orders import \ dist \ ordersImport Jar "C: \ Order \ Sometextfile.txt   

To add postgreski-9.0-801.jdbc4.jar to this line should be something extra? I had included the library inside the project and if I run it straight from Netbeans then it works without any problem. I have seen my previous project, where it worked, it seems that everything There is only one, pathetic I just can not remember, please help.

There should be an entry in your MANIFEST.MF file that refers to the postgrass driver. And the driver needs to be copied so that it is accessible from the actual jar file location.

Then your MANIFEST.MF should include something like this:

class path: lib / postgresql-9.0-801.jdbc4.jar

If JDBC If the driver is part of your Netbans project, then NetBIns should copy it into Copy / Lib.

If you do not want to change the MANIFEST file (or not), then you must manually refer all the required libraries on the command line. But then you can not use the -or option:

java-cp postgresql-9.0-801.jdbc4.jar; Orders import. Com. Please note that you must specify the main category when using cp or -classpath / Html>

Comments