Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver
От | danap |
---|---|
Тема | Re: Error:java.lang.ClassNotFoundException: org.postgresql.Driver |
Дата | |
Msg-id | 56FAAF8E.1080308@itstriangle.com обсуждение исходный текст |
Ответ на | Error:java.lang.ClassNotFoundException: org.postgresql.Driver (Nithin Chakravarthi <nithin@embdestech.co.in>) |
Список | pgsql-jdbc |
Nithin Chakravarthi wrote: > Hi All, > > I am working on java project to insert and fetch data from postgresql database. > While using jbdc I am getting error > > "*java.lang.ClassNotFoundException: org.postgresql.Driver > at java.net.URLClassLoader.findClass(URLClassLoader.java:381) > > ~ > ~ > ~ > > //DriverManager.register(org.postgresql.Driver()); > ServerMain.conn = > DriverManager.getConnection(DB_URL,password); > > " > * > I have exported class path as > > *"export CLASSPATH=./Server.jar:~/Downloads/postgresql-9.3-1103.jdbc3.jar" > * > > Server.jar is main executable file. > > So please help me to solve this issue. > // > Thanks & Regards, > *M. Nithin Chakravrthi* > Software Engineer Hello Nithin, Yes you can use Maven or other to build your jar or can use the basics which is valuable in understanding the process by compiling directly, and creating the jar with the commands, javac, jar. Insure these are on your execution path. See Example Files: https://github.com/danap/myjsqlview make, build, myjsqlview.mf make - Compiles your source files to the specified directly. Use the -classpath to defines libraries, jars, required in the compile. build - Creates your jar file with included jars, your case and other files. myjsqlview.mf - specifiy the inclusion here the main class and required jar, postgresql driver here. Use the .bat files for Win, .sh for Unix/Linux. Alternative, just place the postgresql driver in the jre/lib/ext folder. danap.
В списке pgsql-jdbc по дате отправления: