MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / detect_system_java

Function detect_system_java

rust/src/jre.rs:202–228  ·  view source on GitHub ↗
(log: &Logger)

Source from the content-addressed store, hash-verified

200}
201
202fn detect_system_java(log: &Logger) -> Result<Option<JavaRuntime>, Error> {
203 let java_path = match which("java") {
204 Ok(path) => path,
205 Err(_) => return Ok(None),
206 };
207
208 let version = match read_java_version(&java_path)? {
209 Some(version) => version,
210 None => return Ok(None),
211 };
212
213 if !is_supported_java_version(&version) {
214 log.debug(format!(
215 "System Java found at {} but version {} is below minimum {}",
216 java_path.display(),
217 version,
218 MIN_SUPPORTED_JAVA_MAJOR
219 ));
220 return Ok(None);
221 }
222
223 Ok(Some(JavaRuntime {
224 java_path,
225 version,
226 source: "system-jre".to_string(),
227 }))
228}
229
230fn detect_managed_jre(install_root: &Path) -> Result<Option<JavaRuntime>, Error> {
231 let java_path = find_java_binary(install_root);

Callers 1

ensure_jreFunction · 0.85

Calls 3

read_java_versionFunction · 0.85
debugMethod · 0.45

Tested by

no test coverage detected