Installing nexus error: The version of the JVM must be at least 1.8 and at most 1.8

Ali Behzadian Nejad picture Ali Behzadian Nejad · Mar 12, 2019 · Viewed 7.3k times · Source

I have installed Nexus on Ubuntu 18.04 LTS. When I want to start Nexus service I get this error:

nexus[24049]: No suitable Java Virtual Machine could be found on your system.
nexus[24049]: The version of the JVM must be at least 1.8 and at most 1.8.
nexus[24049]: Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
systemd[1]: nexus.service: Control process exited, code=exited status=83
systemd[1]: nexus.service: Failed with result 'exit-code'.
systemd[1]: Failed to start LSB: nexus.

I have Open JDK version 10.0.2 installed in my system:

openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

My question is why Nexus uses ONLY JDK8? and am I able to have both JDK versions alongside?

Answer

Tom Rutchik picture Tom Rutchik · Aug 5, 2019

INSTALL4J_JAVA_HOME is not an environment variable setting. It is configured in the nexus installation directory. You'll need to edit "/bin/nexus" file.

You'll find near the top of that configuration script a commented out line:

#  INSTALL4J_JAVA_HOME_OVERRIDE=

remove the comment tag and set the value to your jdk location. I set mine to a java 1.8 jdk that I installed. (Not the JDK 11.0.4 default dir that some linux installations are prepackaged with. I read somewhere that you must use the Java 1.8 with nexus version 3.x and that other versions will fail. I don't know the truth to that claim, you certainly can try other version to see if they work.)

After doing that, the nexus service was able to start.

I still haven't been able to get access to the nexus manager through a browser via port 8082. I'm just now trying to track that issue down. Probably a configuration issue or something else I need to set up.