简体   繁体   中英

JDBC classpath issue

I don't like to post a question when so many suggestions pop up when I type the question title in but looking through them all and seeing no solution is somewhat distressing. I've been following a tutorial for java->postgres connections and I am constantly getting slaughtered by

"Could not find or load main class Seb"

error messages.

I've tried using

SET CLASSPATH=%CLASSPATH%:<path to work directory>;<path to jdbc jar>

compiling like so:-

javac -cp .:jdbc.jar Seb.java

and executing like so:-

java -cp .:jdbc.jar Seb

and can't see through the light -_-

The thing is, following the tutorial down to the letter (and watching the demonstration video) doesn't seem to work for me.

I'm simply using notepad and cmd.exe on Windows 8 for development as it's only a learning opportunity, not a big project - but I'm baffled as to why I can't get the thing to run!

JDBC postgres files are in the same directory as .java file.

Code is available if needed as is any other information I can provide.

Thanks in advance for any help,

-Tim!

Use a semi-colon classpath separator for Windows

java -cp .;jdbc.jar Seb
          ^

Read: PATH and CLASSPATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM