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

Conversation

marcodelapierre
Copy link
Member

@marcodelapierre marcodelapierre commented Mar 20, 2024

This PR aims to address #4653, and as such applies a few small edits to the main nextflow script:

  • if no installation found at all (`$JAVA_CMD --version failing), print additional advice (in red):
    NOTE: please refer to the Nextflow Get Started page at https://www.nextflow.io/docs/latest/getstarted.html.
    
  • if SDKMAN sourceable script found but not sourced, have Nextflow source it in case it has Java installed; if Java found this way, also print a notice (in yellow):
    NOTE: Nextflow has found a working SDKMAN Java installation and is going to use it. For a more robust setup, add the following lines at the end of your Bash .profile or .bash_profile:
     export SDKMAN_DIR="$HOME/.sdkman"
     [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
    
    If Java not found, silently fallback to JAVA_CMD=java
  • if /usr/libexec/java_home is found but not working, silently fallback to JAVA_CMD=java, for a less confusing error (I think that path search only works on a Mac and if a system Java has been installed)

…n installation

Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
@marcodelapierre marcodelapierre linked an issue Mar 20, 2024 that may be closed by this pull request
Copy link

netlify bot commented Mar 20, 2024

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit b40c78f
🔍 Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/65fb112ea9a3cf0008a3de09

@pditommaso
Copy link
Member

I would not bind so strictly to SDKman. It would be preferable just report that JAVA_HOME is not defined when it fail to find a java launcher

… detailed

Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
@marcodelapierre
Copy link
Member Author

marcodelapierre commented Mar 20, 2024

Have a look at this iteration:
1- removed auto sourcing of SDKMAN installation
2- message for Java not found more informative:

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    
 - 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 https://www.nextflow.io/docs/latest/getstarted.html.   

nextflow Outdated Show resolved Hide resolved
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
nextflow Outdated Show resolved Hide resolved
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso merged commit ebbbe9e into master Mar 20, 2024
5 checks passed
@pditommaso pditommaso deleted the update/nextflow_java_cmd branch March 20, 2024 16:44
@jason-seqera
Copy link
Contributor

@marcodelapierre thanks!

nschan pushed a commit to nschan/nextflow that referenced this pull request Apr 3, 2024
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Niklas Schandry <niklas@bio.lmu.de>
nschan pushed a commit to nschan/nextflow that referenced this pull request Apr 3, 2024
Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Niklas Schandry <niklas@bio.lmu.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lack of JAVA_HOME causes /bin/java to be assumed
3 participants