Now i tried another example.Look at this.I do not specify any classpaths i.e in environment variable
This is the following directory structure.
I compiled the file2.java successfully and i got the class file.
Now i import the pack2.File2 in File1.java and i used the imported file in file2 class.I compiled the file2.java in pack1 directory only using "javac File2.java".It also successfully compiled.Why it has been compiled.You said that Javac look for only source files in current directory by default.I used the file2 class and it is in pack2 directory.I think javac looks for the source files and class files it needed in current directory by default.Is this right?
I dont know how to run this program.I used the following commands
I am in source directory.I used this command
java -classpath . pack1.File2
You said that we have to give the parent of root package directory.But this is not working.Please give methe correct command