public static void copyJarFile(String srcDir,String destDir,String filename) throws Exception {
  String src=srcDir + FILE_SEP + filename;
  String dest=destDir + FILE_SEP + filename;
  JarInputStream jarIn=null;
  JarOutputStream jarOut=null;
  try {
    jarIn=new JarInputStream(new FileInputStream(src));
    jarOut=new JarOutputStream(new FileOutputStream(dest));
    byte[] buffer=new byte[4096];
    JarEntry entry;
    while ((entry=jarIn.getNextJarEntry()) != null) {
      jarOut.putNextEntry(entry);
      int bytesRead;
      while ((bytesRead=jarIn.read(buffer)) != -1) {
        jarOut.write(buffer,0,bytesRead);
      }
    }
  }
 catch (  Exception e) {
    Debug.log("FileUtils.copyJarFile(): Error occurred while copying " + "jar file: " + src + " to: "+ dest,e);
    throw e;
  }
 finally {
    if (jarIn != null) {
      try {
        jarIn.close();
      }
 catch (      IOException e) {
        Debug.log("FileUtils.copyJarFile(): Error occurred while " + "closing input stream for: " + src);
      }
    }
    if (jarOut != null) {
      try {
        jarOut.flush();
        jarOut.close();
      }
 catch (      IOException e) {
        Debug.log("FileUtils.copyJarFile(): Error occurred while " + "closing output stream for: " + dest);
      }
    }
  }
}

public static void copyJarFile ( String srcDir , String destDir , String filename ) throws Exception { String src = srcDir + FILE_SEP + filename ; String dest = destDir + FILE_SEP + filename ; JarInputStream jarIn = null ; JarOutputStream jarOut = null ; try { jarIn = new JarInputStream ( new FileInputStream ( src ) ) ; jarOut = new JarOutputStream ( new FileOutputStream ( dest ) ) ; byte [ ] buffer = new byte [ 4096 ] ; JarEntry entry ; while ( ( entry = jarIn . getNextJarEntry ( ) ) != null ) { jarOut . putNextEntry ( entry ) ; int bytesRead ; while ( ( bytesRead = jarIn . read ( buffer ) ) != - 1 ) { jarOut . write ( buffer , 0 , bytesRead ) ; } } } catch ( Exception e ) { Debug . log ( "FileUtils.copyJarFile(): Error occurred while copying " + "jar file: " + src + " to: " + dest , e ) ; throw e ; } finally { if ( jarIn != null ) { try { jarIn . close ( ) ; } catch ( IOException e ) { Debug . log ( "FileUtils.copyJarFile(): Error occurred while " + "closing input stream for: " + src ) ; } } if ( jarOut != null ) { try { jarOut . flush ( ) ; jarOut . close ( ) ; } catch ( IOException e ) { Debug . log ( "FileUtils.copyJarFile(): Error occurred while " + "closing output stream for: " + dest ) ; } } } }
method copyjarfile to destination directory
