Question: I have server which communicates with database via JDBC. When I compile it 

`javac -cp jdbc.jar package/Server.java`

I get nonsense errors It can't find my classes in other files. If I compile it without -cp option but run it with -cp option as:

`java -cp jdbc.jar package.Server`
I get:

`Exception in thread "main" java.lang.NoClassDefFoundError: package/Server
Caused by: java.lang.ClassNotFoundException: package.Server`

what is the right way?

Answer: 
Add the current directory to the classpath

```
javac -cp .:jdbc.jar package/Server.java

```
May be you are using eclipse.
And if is that so then just copy your code paste it in some newly created file in home directory and run it. 

I was facing some problem and resolved it by doing above operation. :)