Question: I have created some 4 to 5 Java files. They work well when I run using Netbeans or Eclipse, but when I try to run using command prompt I get some errors. 

* I have put all my files in `jdk/bin` folder.
* I am using MySQL connector jar file - I have put that file in `jdk/bin` folder
* I have set my class path to `jdk/bin` folder

But I get errors like:

```
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at Dbconnection.Dbconnect(Dbconnection.java:29)
    at fileoperation.parsefiles(fileoperation.java:63)
    at fileoperation.main(fileoperation.java:127)

```

Will anybody tell - where is the problem?

Answer: 
First of all try running java and javac from command propmt, if they run properly its fine.
than Try this:

```
javac -cp /path to/your/mysql connector jar file/  MyProgram.java
java -cp  .;/path to/your/mysql connector jar file/ MyProgram

```

`cp` stands for `classpath`

You can also add multiple jar files after -cp.

if they don't run i mean `java or javac not found` error comes up than add `java.exe` and `javac.exe` to your windows `environment variable` 

Add `C:\jdk1.6.0_23\bin` which contains java.exe and javac.exe to your environment variable.
You can't set the directory in the classpath, you either need to specify "\*.jar" under the directory, or specify each jar by name.