I think the given error is because of * placed after package name.[packagename.*;].
If you place a particular class name insted of *, it compiles successfully.
Reason is , when we use -d option, it moves only .class file to the package hierarchy but leaves .java file at original location.
So because we are using *, compiler dont know the class to use at starting, and thus looks for required class file in current directory insted of package. In current directory it gets .java file for that class, so it skips searching and compiles .java [ hope without -d option] and place the .class file at current directory [without creation of hierarchy] which is not reght as we have decleared package in source file.
To overcome this problem we either need to move .java file to same package hierarchy created after compilation of it using -d option,
or move to other location / delete the source file after compiling it using -d option.
If anyone have more useful way to deal with this, please do post.