If JAVA_HOME is in the environ, return $JAVA_HOME/bin/s. Otherwise,
        return s.
434444
def _locate_java(self, s):
        '''
        '''
        if 'JAVA_HOME' in self.buildozer.environ:
            return join(self.buildozer.environ['JAVA_HOME'], 'bin', s)
        else:
            return s
1203357
static Jvm of(final String javaHome) {
        if (javaHome == null) {
            return DEFAULT;
        }
        return of(Paths.get(javaHome));
    }
481862
@Pure
	public static String getVMBinary() {
		final String javaHome = System.getProperty("java.home"); //$NON-NLS-1$
		final File binDir = new File(new File(javaHome), "bin"); //$NON-NLS-1$
		if (binDir.isDirectory()) {
			File exec = new File(binDir, getExecutableFilename("javaw")); //$NON-NLS-1$
			if (exec.isFile()) {
				return exec.getAbsolutePath();
			}
			exec = new File(binDir, getExecutableFilename("java")); //$NON-NLS-1$
			if (exec.isFile()) {
				return exec.getAbsolutePath();
			}
		}
		return null;
	}
230150
private void convertJdkPath(Launcher launcher, EnvVars extendedEnv) {
        String separator = launcher.isUnix() ? "/" : "\\";
        String java_home = extendedEnv.get("JAVA_HOME");
        if (StringUtils.isNotEmpty(java_home)) {
            if (!StringUtils.endsWith(java_home, separator)) {
                java_home += separator;
            }
            extendedEnv.put("PATH+JDK", java_home + "bin");
        }
    }
671096
def get_home_dir():
    
    try:
        # expanduser() returns a raw byte string which needs to be
        # decoded with the codec that the OS is using to represent
        # file paths.
        path = encoding.to_unicode_from_fs(osp.expanduser('~'))
    except Exception:
        path = ''

    if osp.isdir(path):
        return path
    else:
        # Get home from alternative locations
        for env_var in ('HOME', 'USERPROFILE', 'TMP'):
            # os.environ.get() returns a raw byte string which needs to be
            # decoded with the codec that the OS is using to represent
            # environment variables.
            path = encoding.to_unicode_from_fs(os.environ.get(env_var, ''))
            if osp.isdir(path):
                return path
            else:
                path = ''

        if not path:
            raise RuntimeError('Please set the environment variable HOME to '
                               'your user/home directory path so Spyder can '
                               'start properly.')
1100687
def find_jdk_home_dir():
    
    for name in JDK_HOME_VARS:
        jdk_home_dir = os.environ.get(name, None)
        if jdk_home_dir \
                and os.path.exists(os.path.join(jdk_home_dir, 'include')) \
                and os.path.exists(os.path.join(jdk_home_dir, 'lib')):
            return jdk_home_dir
    logger.debug('Checking Maven for JAVA_HOME...')
    try:
        output = subprocess.check_output(['mvn', '-v'])
        if isinstance(output, bytes) and not isinstance(output, str):
            #PY3 related
            output = output.decode('utf-8')
        for part in output.split('\n'):
            if part.startswith('Java home:'):
                path = part.split(':')[1].strip()
                if path.endswith('jre'):
                    return path[0:-3]
                
    except Exception:
        # maven probably isn't installed or not on PATH
        logger.debug('Maven not found on PATH. No JAVA_HOME found.')

    return None
117497
protected File getHomeDir() {
        // check JNDI for the home directory first
        String varName = getApplicationName().toUpperCase() + "_HOME";
        try {
            InitialContext iniCtxt = new InitialContext();
            Context env = (Context) iniCtxt.lookup("java:comp/env");
            String value = (String) env.lookup(varName);
            if(value!=null && value.trim().length()>0)
                return new File(value.trim());
            // look at one more place. See HUDSON-1314
            value = (String) iniCtxt.lookup(varName);
            if(value!=null && value.trim().length()>0)
                return new File(value.trim());
        } catch (NamingException e) {
            // ignore
        }

        // finally check the system property
        String sysProp = System.getProperty(varName);
        if(sysProp!=null)
            return new File(sysProp.trim());

        // look at the env var next
        String env = System.getenv(varName);
        if(env!=null)
            return new File(env.trim()).getAbsoluteFile();

        return getDefaultHomeDir();
    }
751582
protected static String getHomeDir(String[] args) {
        if (System.getenv(HOME_DIR) == null) {
            if (args.length > index) {
                return args[index++];
            } else {
                return ".";
            }
        } else {
            return System.getenv(HOME_DIR);
        }
    }
235137
def get_kde_home_dir ():
    """"""
    if os.environ.get("KDEHOME"):
        kde_home = os.path.abspath(os.environ["KDEHOME"])
    else:
        home = os.environ.get("HOME")
        if not home:
            # $HOME is not set
            return
        kde3_home = os.path.join(home, ".kde")
        kde4_home = os.path.join(home, ".kde4")
        if fileutil.find_executable("kde4-config"):
            # kde4
            kde3_file = kde_home_to_config(kde3_home)
            kde4_file = kde_home_to_config(kde4_home)
            if os.path.exists(kde4_file) and os.path.exists(kde3_file):
                if fileutil.get_mtime(kde4_file) >= fileutil.get_mtime(kde3_file):
                    kde_home = kde4_home
                else:
                    kde_home = kde3_home
            else:
                kde_home = kde4_home
        else:
            # kde3
            kde_home = kde3_home
    return kde_home if os.path.exists(kde_home) else None
957076
def GetJavaInstallationPath():
		
		import os, platform

		# Get JavaPath for Ubuntu
		# if os.name == "posix":
		if platform.system() == "Linux":
			path = os.environ.get('JAVA_HOME')
			if not path:
				raise UcsValidationException(
					"Please make sure JAVA is installed and variable JAVA_HOME is set properly.")
			# raise Exception("Please make sure JAVA is installed and variable JAVA_HOME is set properly.")
			else:
				path = os.path.join(path, 'bin')
				path = os.path.join(path, 'javaws')
				if not os.path.exists(path):
					raise UcsValidationException("javaws is not installed on System.")
				# raise Exception("javaws is not installed on System.")
				else:
					return path

		# Get JavaPath for Windows
		# elif os.name == "nt":
		elif platform.system() == "Windows" or platform.system() == "Microsoft":

			path = os.environ.get('JAVA_HOME')

			if path == None:
				path = UcsUtils.CheckRegistryKey(r"SOFTWARE\\JavaSoft\\Java Runtime Environment\\")

			if path == None:  # Check for 32 bit Java on 64 bit machine.
				path = UcsUtils.CheckRegistryKey(r"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Runtime Environment")

			if not path:
				raise UcsValidationException("Please make sure JAVA is installed.")
			# raise Exception("Please make sure JAVA is installed.")
			else:
				path = os.path.join(path, 'bin')
				path = os.path.join(path, 'javaws.exe')
				if not os.path.exists(path):
					raise UcsValidationException("javaws.exe is not installed on System.")
				# raise Exception("javaws.exe is not installed on System.")
				else:
					return path
884908
private static function environmentVariableExists($name)
    {
        switch (true) {
            case array_key_exists($name, $_ENV):
                return true;
            case array_key_exists($name, $_SERVER):
                return true;
            default:
                $value = getenv($name);
                return $value !== false;
        }
    }
1030094
def get_java_binpath(cmd=None):
    
    if os.environ.get("BCBIO_JAVA_HOME"):
        test_cmd = os.path.join(os.environ["BCBIO_JAVA_HOME"], "bin", "java")
        if os.path.exists(test_cmd):
            cmd = test_cmd
    if not cmd:
        cmd = Rscript_cmd()
    return os.path.dirname(cmd)
331684
def get_from_environment():
    '''
        
    '''
    name = os.environ.get("EXECJS_RUNTIME", "")
    if not name:
        return None

    try:
        return _find_runtime_by_name(name)
    except exceptions.RuntimeUnavailableError:
        return None
947994
protected function findShellConfigFile()
    {
        // Special handling for the .environment file on Platform.sh environments.
        $envPrefix = $this->config()->get('service.env_prefix');
        if (getenv($envPrefix . 'PROJECT') !== false
            && getenv($envPrefix . 'APP_DIR') !== false
            && getenv($envPrefix . 'APP_DIR') === Filesystem::getHomeDirectory()) {
            return getenv($envPrefix . 'APP_DIR') . '/.environment';
        }

        $shell = null;
        if (getenv('SHELL') !== false) {
            $shell = basename(getenv('SHELL'));
            $this->debug('Detected shell: ' . $shell);
        }

        $candidates = [
            '.bashrc',
            '.bash_profile',
        ];

        // OS X ignores .bashrc if .bash_profile is present.
        if (OsUtil::isOsX()) {
            $candidates = [
                '.bash_profile',
                '.bashrc',
            ];
        }

        if ($shell === 'zsh' || getenv('ZSH')) {
            array_unshift($candidates, '.zshrc');
            array_unshift($candidates, '.zprofile');
        }

        $homeDir = Filesystem::getHomeDirectory();
        foreach ($candidates as $candidate) {
            if (file_exists($homeDir . DIRECTORY_SEPARATOR . $candidate)) {
                $this->debug('Found existing config file: ' . $homeDir . DIRECTORY_SEPARATOR . $candidate);

                return $homeDir . DIRECTORY_SEPARATOR . $candidate;
            }
        }

        // If none of the files exist (yet), and we are on Bash, and the home
        // directory is writable, then use ~/.bashrc.
        if (is_writable($homeDir) && $shell === 'bash') {
            $this->debug('Defaulting to ~/.bashrc');

            return $homeDir . DIRECTORY_SEPARATOR . '.bashrc';
        }

        return false;
    }
826617
function getHomePath () {
  if (process.platform === 'win32') {
    return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || process.env.HOME
  } else {
    return process.env.HOME
  }
}
445196
def show_env():
    '''
    
    '''
    envs = ['PATH', 'ORACLE_HOME', 'TNS_ADMIN', 'NLS_LANG']
    result = {}
    for env in envs:
        if env in os.environ:
            result[env] = os.environ[env]
    return result
595455
def get_home():
    
    path = ''
    try:
        path = os.path.expanduser("~")
    except:
        pass
    if not os.path.isdir(path):
        for evar in ('HOME', 'USERPROFILE', 'TMP'):
            try:
                path = os.environ[evar]
                if os.path.isdir(path):
                    break
            except:
                pass
    if path:
        return path
    else:
        raise RuntimeError('please define environment variable $HOME')