<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def java(items):
 """Check for presence of external Java 1.7 for tools that require it. """

    if any([_needs_java(d) for d in items]):
        min_version = "1.7"
        max_version = "1.8"
        with setpath.orig_paths():
            java = utils.which("java")
            if not java:
                return ("java not found on PATH. Java %s required for MuTect and GATK < 3.6." % min_version)
            p = subprocess.Popen([java, "-Xms250m", "-Xmx250m", "-version"],
                                 stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            output, _ = p.communicate()
            p.stdout.close()
        version = ""
        for line in output.split("\n"):
            if line.startswith(("java version", "openjdk version")):
                version = line.strip().split()[-1]
                if version.startswith('"'):
                    version = version[1:]
                if version.endswith('"'):
                    version = version[:-1]
        if (not version or LooseVersion(version) >= LooseVersion(max_version) or
            LooseVersion(version) < LooseVersion(min_version)):
            return ("java version %s required for running MuTect and GATK < 3.6.\n"
                    "It needs to be first on your PATH so running 'java -version' give the correct version.\n"
                    "Found version %s at %s" % (min_version, version, java))