Question: I am trying to do "javac Classname.java" from cmd prompt, and this Classname.java requires Jfreechart libraries/jars, and runs fine if compiled from Eclipse (because project package has jars imported).

But I want to run the file from cmd prompt and its not able to show me the output. It comes with errors like: ("package doesn't exist"), how to fix it? I need the class file and also run JNI commands to create header file.

Answer: 
You need to [set the classpath](http://download.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html).

You can do this in 2 ways. Either use the `-classpath` or `-cp` option:

```
javac -cp jar1.jar;path/to/jar2.jar Classname.java

```

Or, if you need it to persist, use the `CLASSPATH` environmental variable:

```
set CLASSPATH=path1;path2
javac Classname.java

```
If you have already managed to run your code in Eclipse, then Eclipse can help you.

In the "Debug" view, you should have something like this remaining after you have run your code:

![Screenshot of Debug view](https://i.stack.imgur.com/DfBUr.png)

If you right-click the bottom "terminated" text and select "Properties", you will get something like this:

![enter image description here](https://i.stack.imgur.com/O7chr.png)

You can copy the command line content and use that to run your app from the command line, or use it to set the classpath as the other answers have advised.