简体   繁体   English

Java classpath jdbc问题

[英]Java classpath jdbc issue

I have run into crazy problem. 我遇到了疯狂的问题。

Below is my directory structure 下面是我的目录结构

 - src
       Sub - directory are
       - com/abc/www      MyJava.java (Contains the package com.abc.www)
 - lib
       It contains the jar files like sqljdbc4.jar
 - bin
       It contains the class file , that I had compiled the 
       package directory structure created automatically
       - com/abc/www/MyJava.class

I used the below line to compile my code : 我用下面的代码来编译我的代码:

java -cp "lib\*" -d bin src\com\abc\www\MyJava.java

It compiled successfully. 它编译成功。

Well, now when I m trying to execute my code: cd bin java com.abc.www.MyJava 好吧,现在当我尝试执行代码时:cd bin java com.abc.www.MyJava

Unfortunately, it is giving me the below error: 不幸的是,这给了我以下错误:

java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
  at java.net.URLClassLoader$1.run (URLClassLoader.java:202)
  ....

Any inputs on the same , would be helpful. 在上的任何输入都将有所帮助。

Thanks !!!! 谢谢 !!!!

你能试一下吗:

java -cp .;bin;lib\sqljdbc4.jar com.abc.www.MyJava

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

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