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

Add mandatory check for JAVA_HOME #197

Merged
merged 2 commits into from
Jan 18, 2016
Merged
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
11 changes: 8 additions & 3 deletions assembly-main/src/assembly/bin/che.sh
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,20 @@ function call_catalina {
return
fi

if [ -z "${JAVA_HOME}" ]; then
error_exit "JAVA_HOME is not set. Please set to directory of JVM or JRE."
return
fi

# Test to see that Java is installed and working
java &>/dev/null || JAVA_EXIT=$? || true
"${JAVA_HOME}"/bin/java &>/dev/null || JAVA_EXIT=$? || true
if [ "${JAVA_EXIT}" != "1" ]; then
error_exit "We could not find a working Java JVM. java command fails."
return
fi

# Che requires Java version 1.8 or higher.
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
JAVA_VERSION=$(eval "${JAVA_HOME}"/bin/java -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$JAVA_VERSION" < "1.8" ]]; then
error_exit "Che requires Java version 1.8 or higher. We found a lower version."
return
Expand Down Expand Up @@ -561,7 +566,7 @@ function launch_che_server {
echo -e "Launching Che app server inside the container named ${GREEN}che${NC}."

# For some reason, launching tomcat with the start option in a docker container does not run successfully - only launch with run action
"${DOCKER}" exec -it che bash -c 'true && export CHE_HOME=/home/user/che && /home/user/che/bin/che.sh -s run' || DOCKER_EXIT=$? || true
"${DOCKER}" exec -it che bash -c 'true && export CHE_HOME=/home/user/che && /home/user/che/bin/che.sh --skip:client run' || DOCKER_EXIT=$? || true
fi
}

Expand Down