Module: BitGirder::Ops::Java::JavaEnvironments

Extended by:
Core::BitGirderMethods
Defined in:
lib/bitgirder/ops/java.rb

Constant Summary collapse

ENV_JAVA_HOME =
"JAVA_HOME"

Constants included from Core::BitGirderMethods

Core::BitGirderMethods::PARAM_TYPE_ARG, Core::BitGirderMethods::PARAM_TYPE_ENVVAR, Core::BitGirderMethods::PARAM_TYPE_KEY

Class Method Summary collapse

Methods included from Core::BitGirderMethods

argv_to_argh, check_fail_prefix, class_name_to_sym, code, compares_to, console, ext_to_class_name, ext_to_sym, has_env, has_key, has_keys, nonnegative, not_nil, positive, raisef, set_from_key, set_var, split_argv, sym_to_cli_switch, sym_to_ext_id, to_bool, unpack_argv_array, unpack_argv_hash, warn

Class Method Details

.get_java_homeObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/bitgirder/ops/java.rb', line 16

def get_java_home

    if res = ENV[ ENV_JAVA_HOME ]
        if File.exist?( res )
            res
        else
            raise 
                "Location specified in #{ENV_JAVA_HOME} doesn't exist: " +
                res
        end
    else
        if jv = Io.which( "java" )
            File.dirname( File.dirname( jv ) )
        else
            raise "#{ENV_JAVA_HOME} is not set and no 'java' found on path"
        end
    end
end