def _java_install(pname, version, url, env, install_fn=None,
                  pre_fetch_fn=None):
    """Download java jars into versioned input directories.

    pre_fetch_fn runs before URL retrieval, allowing insertion of
    manual steps like restricted downloads.
    """
    install_dir = _symlinked_java_version_dir(pname, version, env)
    if install_dir:
        with _make_tmp_dir() as work_dir:
            with cd(work_dir):
                if pre_fetch_fn:
                    out = pre_fetch_fn(env)
                    if out is None:
                        return
                dir_name = _fetch_and_unpack(url)
                with cd(dir_name):
                    if install_fn is not None:
                        install_fn(env, install_dir)
                    else:
                        env.safe_sudo("mv *.jar %s" % install_dir)
dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/custom/shared.py/_java_install/original