Question: I know this question has already been answered many times, but unfortunately I couldn't find the right answer to my questions.

below is my package structure and inside my package I have SimpleTest.java

d:\junit\src\junitfaq\SimpleTest.java

inside d:\junit\src> i tried to compile SimpleTest.java and it successfully compiled using the command below.

d:\junit\src>javac junitfaq/SimpleTest.java 

but when i try to run the program using command line below

d:\junit\src>java junitfaq.SimpleTest 

this error occured. Error: Could not find or load main class junitfaq.SimpleTest

I tried running it by accessing junitfaq package by using this command

d:\junit\src\junitfaq>java -cp . SimpleTest

the program run perfectly. A little help would be much appreciated.

Answer: 
It sounds like you have a classpath problem; you should double-check the location of your class file, the directory/package structure, the location from which you're trying to run the java command, and any classpath specified during execution. 

For example, the following works for me: 

```
$ mkdir junitfaq
$ cat >junitfaq/SimpleTest.java
package junitfaq;
public class SimpleTest
{
    public static void main(String[] args)
    {
        System.out.println("Hello, world!");
    }
}
^D
$ javac junitfaq/SimpleTest.java
$ java junitfaq.SimpleTest
Hello, world!
$ java -cp . junitfaq.SimpleTest
Hello, world!
$ 

```

Not to belabor the obvious, but I noticed a spelling typo in one of your comments - you should also double-check that you're running the command as intended.
trialYou could try putting your java and class files together with your libaray folder (if any) in a new file called "trial" in your C:\ directory then compile existing java file using the following->

C:\trial> javac -cp .;library folder\* SimpleTest.java

(then)

C:\trial> java -cp .;library folder\* SimpleTest

Let me know how you get on!