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

Method installJRE

src/java/supply/supply.go:91–124  ·  view source on GitHub ↗

installJRE installs the Java Runtime Environment. Returns the installed JRE instance and its name so the caller can persist them to config.yml.

()

Source from the content-addressed store, hash-verified

89// installJRE installs the Java Runtime Environment.
90// Returns the installed JRE instance and its name so the caller can persist them to config.yml.
91func (s *Supplier) installJRE() (jres.JRE, string, error) {
92 // Create JRE context
93 ctx := &common.Context{
94 Stager: s.Stager,
95 Manifest: s.Manifest,
96 Installer: s.Installer,
97 Log: s.Log,
98 Command: s.Command,
99 }
100
101 // Create and populate JRE registry
102 registry := jres.NewRegistry(ctx)
103 registry.RegisterStandardJREs()
104
105 // Detect which JRE to use.
106 // With SetDefault(openJDK) configured, this will always return a JRE unless
107 // an explicitly configured JRE fails detection.
108 jre, jreName, err := registry.Detect()
109 if err != nil {
110 s.Log.Error("Failed to detect JRE: %s", err.Error())
111 return nil, "", err
112 }
113
114 s.Log.Info("Selected JRE: %s", jreName)
115
116 // Install the JRE
117 if err := jre.Supply(); err != nil {
118 s.Log.Error("Failed to install JRE: %s", err.Error())
119 return nil, "", err
120 }
121
122 s.Log.Debug("JRE installation complete: %s %s", jreName, jre.Version())
123 return jre, jreName, nil
124}
125
126// installFrameworks installs framework components (APM agents, etc.)
127func (s *Supplier) installFrameworks() error {

Callers 1

RunFunction · 0.80

Calls 5

RegisterStandardJREsMethod · 0.95
DetectMethod · 0.95
NewRegistryFunction · 0.92
SupplyMethod · 0.65
VersionMethod · 0.65

Tested by

no test coverage detected