code: public static File toJar(File sourceDir, String jarName) {
  		if (!sourceDir.isAbsolute()) {
  			throw new IllegalArgumentException("Source must be expressed through absolute path");
  		}
  		Manifest manifest = new Manifest();
  		manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
  		File jarFile = new File(jarName);
  		try {
  			JarOutputStream target = new JarOutputStream(new FileOutputStream(jarFile), manifest);
  			add(sourceDir, sourceDir.getAbsolutePath().length(), target);
  			target.close();
  		}
  		catch (Exception e) {
  			throw new IllegalStateException("Failed to create JAR file '"
  					+ jarName + "' from " + sourceDir.getAbsolutePath(), e);
  		}
  		return jarFile;
  	}
docs: Will create a JAR file from base dir
  
  @param sourceDir
  @param jarName
  @return