简体   繁体   中英

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

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

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