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

Nextflow launch script: improving search for JAVA_CMD #4830

Merged
merged 4 commits into from
Mar 20, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion nextflow
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ if [ ! -x "$JAVA_CMD" ] ; then
JAVA_CMD="$JAVA_HOME/bin/java"
fi
elif [ -x /usr/libexec/java_home ]; then
JAVA_CMD="$(/usr/libexec/java_home -v 1.8+)/bin/java"
JAVA_CMD="$(/usr/libexec/java_home -v 1.8+ 2>/dev/null)/bin/java" || JAVA_CMD=java
pditommaso marked this conversation as resolved.
Show resolved Hide resolved
else
JAVA_CMD="$(which java)" || JAVA_CMD=java
fi
Expand All @@ -288,7 +288,13 @@ if [ -f "$JAVA_KEY" ]; then
else
JAVA_VER="$("$JAVA_CMD" $NXF_OPTS -version 2>&1)"
if [ $? -ne 0 ]; then
getstarted_web="https://www.nextflow.io/docs/latest/getstarted.html"
echo_red "${JAVA_VER:-Failed to launch the Java virtual machine}"
echo_red "NOTE: Nextflow needs a Java virtual machine to run. To this end:
- make sure a \`java\` command can be found; or
- manually define the variables NXF_JAVA_HOME, JAVA_HOME or JAVA_CMD to point to an existing installation; or
pditommaso marked this conversation as resolved.
Show resolved Hide resolved
- install a Java virtual machine, for instance through https://sdkman.io (read the docs);
- for more details please refer to the Nextflow Get Started page at ${getstarted_web}."
echo_yellow "NOTE: Nextflow is trying to use the Java VM defined by the following environment variables:\n JAVA_CMD: $JAVA_CMD\n NXF_OPTS: $NXF_OPTS\n"
exit 1
fi
Expand Down