1

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 !!!!

4
  • give the -cp flag to the startup as well Commented Jul 11, 2012 at 16:51
  • java -cp "lib*" src\com\abc\www\MyJava for running the application. Commented Jul 11, 2012 at 16:55
  • nope , it shows , then it shows NoClassDefFoundException. Commented Jul 11, 2012 at 16:59
  • its lib\*. the same command which you used for compiling but without the .java extn. Commented Jul 11, 2012 at 17:05

1 Answer 1

1

Can you try:

java -cp .;bin;lib\sqljdbc4.jar com.abc.www.MyJava
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.