Skip to main content

parse_java_major

Function parse_java_major 

Source
pub fn parse_java_major(version_output: &str) -> Option<u32>
Expand description

Parse the major version out of java -version output.

The output goes to stderr, and the two shapes in the wild are "21.0.2" (modern) and "1.8.0_412" (legacy, where the major is the second component). Returning None for anything unrecognized keeps a surprising vendor string from being read as a version far too low.