I think the following solution might help you.
Since class1 and class2 are classes,don't specify any import
statements as only packages can be imported.but before compiling
class2 make sure you have set the classpath to class1.
suppose if u have arranged your file as follows :
c:\Demo\class1.java
&
c:\Trial\class2.java
then before compiling class2.java set the classpath as
set classpath=.;c:\demo