Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn on java over max supported version #3429

Open
wants to merge 4 commits into
base: v2.x/staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
All notable changes to the Zowe Installer will be documented in this file.
<!--Add the PR or issue number to the entry if available.-->

## `2.9.0`

#### Minor enhancements/defect fixes
- Enhancement: Warn when detecting a java version newer than what's officially known to work.

## `2.8.0`

### New features and enhancements
Expand Down
12 changes: 9 additions & 3 deletions bin/libs/java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ require_java() {


validate_java_home() {
java_min_version=8
java_max_warn=8

java_home="${1:-${JAVA_HOME}}"

if [ -z "${java_home}" ]; then
Expand Down Expand Up @@ -121,14 +124,17 @@ validate_java_home() {
too_low=
if [ ${java_major_version} -lt 1 ]; then
too_low="true"
elif [ ${java_major_version} -eq 1 -a ${java_minor_version} -lt 8 ]; then
elif [ ${java_major_version} -eq 1 -a ${java_minor_version} -lt ${java_min_version} ]; then
too_low="true"
fi
if [ "${too_low}" = "true" ]; then
print_error "Java ${java_version_short} is less than the minimum level required of Java 8 (1.8.0)."
return 1
fi
print_debug "Java ${java_version_short} is supported."

if [ ${java_minor_version} -gt ${java_max_warn} ]; then
print_error "Warning: Java version ${java_version_short} is greater than the maximum known working version of Java ${java_max_warn}."
else
print_debug "Java ${java_version_short} is supported."
fi
print_debug "Java check is successful."
}
8 changes: 6 additions & 2 deletions bin/libs/java.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import * as shell from './shell';
import * as config from './config';

const JAVA_MIN_VERSION=8;
const JAVA_MAX_WARN=8; //warn if newer than this
//const JAVA_MAX_ERROR=8; //error on this.

export function ensureJavaIsOnPath(): void {
let path=std.getenv('PATH') || '/bin:.:/usr/bin';
Expand Down Expand Up @@ -129,9 +131,11 @@ export function validateJavaHome(javaHome:string|undefined=std.getenv("JAVA_HOME
if (tooLow) {
common.printError(`Java ${javaVersionShort} is less than the minimum level required of Java ${JAVA_MIN_VERSION}.`);
return false;
} else if (javaMajorVersion > JAVA_MAX_WARN) {
common.printError(`Warning: Java version ${javaVersionShort} is greater than the maximum known working version of Java ${JAVA_MAX_WARN}.`);
} else {
common.printDebug(`Java ${javaVersionShort} is supported.`);
}

common.printDebug(`Java ${javaVersionShort} is supported.`);
common.printDebug(`Java check is successful.`);
return true;
} catch (e) {
Expand Down