PGJDBC Issue

Hello, I'm trying to setup PostgreSQL JDBC Driver with my Java project. I'm not using Maven, don't want to. I haven't been able to figure it out... Please, I need help. This happens when I run the program (after setting CLASSPATH to the path of my driver, which is in the same folder as MyClass):
java MyClass
Error: Could not find or load main class MyClass
java MyClass
Error: Could not find or load main class MyClass
But when I do the following, it executes. Though, the driver isn't found? I specified the CLASSPATH and it's in the same folder as the code.
java
java -cp . MyClass
Exception in thread "main" java.lang.ClassNotFoundException: org.postgresql.Driver
java
java -cp . MyClass
Exception in thread "main" java.lang.ClassNotFoundException: org.postgresql.Driver
The file structure is Project ---Postgres.jar (driver) ---MyClass.java ---MyClass.class I have no idea what I'm doing wrong here...
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server