Bro...I guess it should have something to do with the following 2 concepts: classpath configuration and packaging a class
first, you need to set the classpath appropriately, for example you can set the classpath to the current folder by specifying it at command line, using this flag
-cp .
if you do this, then everytime you refer to a class in your source file , the compiler and JVM will look for that class at the current folder and if they couldn't find it, then there will be an error. But, a BIG POINT here, which I guess is the main problem that causes the compiler error in your situation, is that if that class is packaged in a package (such as package "pak"), then compiler and JVM will look for that class at the subfolder "pak" of the folder specified at classpath (in this case the current folder)
now, back to your case as an example. At pakTest2.java, you declare a local variable:
pak.TestPak tp=new pak.TestPak()
inside the main method. The compiler assumes that TestPak class is packaged to a package "pak" (since you declare it as pak.TesPak) and it needs to know where to find that class and it uses the Classpath variable to find it. If you set the classpath variable to the current folder and call javac command from the folder:
D:\JAVA\shekhar java\sudiptoNew\pak\javac -cp . TestPak2.java
then the compiler will look for TestPak class at the subfolder "pak" of the folder "pak", i.e. the compiler look for TestPak class at the folder
D:\JAVA\shekhar java\sudiptoNew\pak\pak
which I assume isn't available and forces the compiler to generate errors saying that the class "TestPak" couldn't be found.
You can solve your problem in several ways, for example :
1. invoke javac command from the folder D:\JAVA\shekhar java\sudiptoNew and set the classpath to the current folder, i.e:
D:\JAVA\shekhar java\sudiptoNew\javac -cp . pak\TestPak2.java
2. invoke javac command from the folder D:\JAVA\shekhar java\sudiptoNew\pak and set the classpath to the super folder, i.e.:
D:\JAVA\shekhar java\sudiptoNew\pak\javac -cp .. TestPak2.java
well..obviously the 2 ways above aren't the only ways..you can do some combinations on classpath variable and referring to the source file TestPak.java by also specifying its path.
Hope this helps....
Khomeini