title: How do i make this File I/O Java program run in Unix?
body: <p>Below is the program that prints all the files &amp; folders from the given path.</p>
  
  <pre><code>import java.io.File;
  
  public class ListDirectoryRecursive{
  
      public static void listRecursive(File dir){
          if(dir.isDirectory()){
              File[] items = dir.listFiles();
              for(File item : items){
                  System.out.println(item.getAbsoluteFile());
                  if(item.isDirectory()){
                      listRecursive(item);
                  }
              }
          }
      }
  
      public static void main(String[] args){
          /* Unix path is: /usr/home/david/workspace/JavaCode */
          File dir = new File("C:\\Users\\david\\workspace\\JavaCode");
          listRecursive(dir);
      }
  }
  </code></pre>
  
  <p>How do i make this java program run on Unix? What is the standard approach to make this program portable?</p>
  
  <p>Edit: I guess, we know on any OS, user home directory is part of the environment setting with values like "c:\users\david" in windows and "/user/home/david" in Unix.</p>