code: public static void extract(Resource resource, File directory, boolean deleteOnExit)
          throws IOException
      {
          if(log.isDebugEnabled())log.debug("Extract "+resource+" to "+directory);
          JarInputStream jin = new JarInputStream(resource.getInputStream());
          JarEntry entry=null;
          while((entry=jin.getNextJarEntry())!=null)
          {
              File file=new File(directory,entry.getName());
              if (entry.isDirectory())
              {
                  // Make directory
                  if (!file.exists())
                      file.mkdirs();
              }
              else
              {
                  // make directory (some jars don't list dirs)
                  File dir = new File(file.getParent());
                  if (!dir.exists())
                      dir.mkdirs();
  
                  // Make file
                  FileOutputStream fout = null;
                  try
                  {
                      fout = new FileOutputStream(file);
                      IO.copy(jin,fout);
                  }
                  finally
                  {
                      IO.close(fout);
                  }
  
                  // touch the file.
                  if (entry.getTime()>=0)
                      file.setLastModified(entry.getTime());
              }
              if (deleteOnExit)
                  file.deleteOnExit();
          }
      }
docs: /* ------------------------------------------------------------