简体   繁体   English

JDBC类路径问题

[英]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 我一直在关注Java-> postgres连接的教程,但我不断被它所杀

"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! 我只是在Windows 8上使用notepad和cmd.exe进行开发,因为这只是一个学习机会,而不是一个大项目-但我对为什么无法运行该东西感到困惑!

JDBC postgres files are in the same directory as .java file. JDBC postgres文件与.java文件位于同一目录中。

Code is available if needed as is any other information I can provide. 如果需要,可以提供代码以及我可以提供的任何其他信息。

Thanks in advance for any help, 预先感谢您的帮助,

-Tim! -Tim!

Use a semi-colon classpath separator for Windows 在Windows上使用分号类路径分隔符

java -cp .;jdbc.jar Seb
          ^

Read: PATH and CLASSPATH 阅读: PATH和CLASSPATH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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