title: Java class in jsp
body: <p>so i dont know how i import a java class correctly. Im working with eclipse tomcat 7 and liferay. 
  in liferay is a directory with img files i'll open the directory with java. thats works fine (local) an i get an array with the paths. so i will create a portlet in liferay in jsp and get the array in jsp. any ideas? 
   my jsp :</p>
  
  <pre><code>&lt;%@ page import ="OpenDir" %&gt;
  &lt;%@ page import="java.io.File"%&gt;
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>&lt;%=
      OpenDir.Dir()
  %&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>my java:</p>
  
  <pre><code>package life_ray;
  
  import java.io.File;
  
  public class OpenDir {
  
      public static void Dir() {
  
          int i = 0;
          File directory = new File(
                  "C:\\Users\\Public\\Pictures\\Sample Pictures\\");
          File[] contents = directory.listFiles();
          for (File f : contents) {
              f.getAbsolutePath();
              i++;
          }
          String[] name = new String[i];
  
          i = 0;
          for (File f : contents) {
              name[i] = f.getAbsolutePath();
              i++;
          }
          i = 0;
          for (File f : contents) {
              name[i] = f.getAbsolutePath();
              System.out.println("&lt;img src=\"" + name[i] + "\" alt=\"\"&gt;");
              i++;
          }
  
      }
  }
  
  
  
  
  
  
  
  so here is my error:
  Caused by: org.apache.jasper.JasperException: Unable to compile class for JSP: 
  
  An error occurred at line: 14 in the generated java file
  Only a type can be imported. life_ray.OpenDir resolves to a package
  
  An error occurred at line: 7 in the jsp file: /view.jsp
  OpenDir cannot be resolved
  4: &lt;body&gt;
  5: 
  6:  &lt;%=
  7:      OpenDir.Dir()
  8:  %&gt;
  9: 
  10: 
  </code></pre>