MCPcopy Create free account
hub / github.com/cloudfoundry/java-buildpack / GetJavaMajorVersion

Function GetJavaMajorVersion

src/java/common/context.go:114–120  ·  view source on GitHub ↗

GetJavaMajorVersion returns the Java major version from the JAVA_HOME environment variable. This is a convenience wrapper around DetermineJavaVersion that reads JAVA_HOME from the environment. Returns the major version (8, 11, 17, etc.) or an error if JAVA_HOME is not set or the version cannot be d

()

Source from the content-addressed store, hash-verified

112//
113// version, err := GetJavaMajorVersion()
114func GetJavaMajorVersion() (int, error) {
115 javaHome := os.Getenv("JAVA_HOME")
116 if javaHome == "" {
117 return 0, fmt.Errorf("JAVA_HOME not set")
118 }
119 return DetermineJavaVersion(javaHome)
120}
121
122// VCAPServices represents the VCAP_SERVICES environment variable structure
123// This is a map of service labels to arrays of service instances

Callers 3

FinalizeMethod · 0.92
FinalizeMethod · 0.92
FinalizeMethod · 0.92

Calls 1

DetermineJavaVersionFunction · 0.85

Tested by

no test coverage detected