You can otherwise set the CLASSPATH to the correct directory i.e.
CLASSPATH=src;
probably your files in source are in good package structure.
How this works? Here it is
when you set the classpath to src, the javac or
java uses them to find other classes. For this situation your file in pack2 will have the package statement as
package com.samples.java.pack2;
when this statement is encountered it checks whether a folder named "com" exists or not. for this it checks all the paths set in the classpath variable. since our classpath is set, it find com and it finds samples etc.