private static void createJar(File dir, File jarFile) throws IOException {
    Preconditions.checkNotNull(dir, "dir");
    Preconditions.checkNotNull(jarFile, "jarFile");
    File jarDir = jarFile.getParentFile();
    if (!jarDir.exists()) {
      if (!jarDir.mkdirs()) {
        throw new IOException(MessageFormat.format("could not create dir [{0}]", jarDir));
      }
    }
    JarOutputStream zos = new JarOutputStream(new FileOutputStream(jarFile));
    jarDir(dir, StringUtils.EMPTY, zos);
  }
Returns the full path to the Jar containing the class. It always return a JAR.

@param klass
         class.

@return path to the Jar containing the class.
ql/src/java/org/apache/hadoop/hive/ql/metadata/JarUtils.java