Search code examples
javacytoscapeadoptopenjdk

Correct method to use prebuilt OpenJDK binary


In the process of trying to install Cytoscape - https://cytoscape.org/download.html, I downloaded prebuilt OpenJDK binary from https://adoptium.net/

Copied OpenJDK21U-jdk_x64_linux_hotspot_21.0.1_12.tar.gz to /usr/lib/jvm and

sudo tar xvf OpenJDK21U-jdk_x64_linux_hotspot_21.0.1_12.tar.gz

Now there's jdk-21.0.1+12 in /usr/lib/jvm

But sudo update-alternatives --config java shows

    There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
* 1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 

Not really sure why jdk-21.0.1+12 does not show up.

Neverthless, I added these in /etc/environment

JAVA_HOME="/usr/lib/jvm/jdk-21.0.1+12/bin/java"
INSTALL4J_JAVA_HOME="/usr/lib/jvm/jdk-21.0.1+12/bin/java"

echo $JAVA_HOME and echo $INSTALL4J_JAVA_HOME shows these as expected

But sudo sh Cytoscape_3_10_1_unix.sh gives

No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 17.0.2 and at most 17.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

I suppose I'm not following the correct method to use the prebuilt OpenJDK binary. Could someone please guide me ?


Solution

  • The error message actually clearly mentioned the issue.

    I downloaded jdk version 17 from https://adoptium.net/temurin/releases/?version=17&os=linux and followed the same procedure as above. The Cytoscape installation was successful :)

    sudo update-alternatives --config java still doesn't show this java version. Not sure why though.