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

neo4j won't run under Java 1.8 on OS X #6895

Closed
apjanke opened this issue Apr 11, 2016 · 6 comments
Closed

neo4j won't run under Java 1.8 on OS X #6895

apjanke opened this issue Apr 11, 2016 · 6 comments

Comments

@apjanke
Copy link

apjanke commented Apr 11, 2016

Versions

Neo4j 2.3.3
OS X 10.11.4; OS X 10.9.5; OS X 10.1.

Descriptions

Neo4j won't run if Java 1.8 but not Java 1.7 is installed. This seems inconsistent with the System Requirements which say that it runs on Java 7 or 8 and prefers 8.

==> /usr/local/Cellar/neo4j/2.3.3/bin/neo4j start
Unable to find any JVMs matching version "1.7".
Starting Neo4j Server.../private/tmp/neo4j20160409-6943-xeqly1/libexec/data/log/neo4j.log was missing, recreating...
WARNING: not changing user
process [7054]... waiting for server to be ready.. Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.

To reproduce, install Java 1.8 on your OS X machine and make sure Java 1.7 is not installed. Install Neo4j and run /usr/local/Cellar/neo4j/2.3.3/bin/neo4j start. Expected it to run under this configuration.

I think the issue is with the Java detection in bin/utils in the 2.3.3 distribution where it does the following.

           if [ -z "$JAVA_HOME" ] ; then
             JAVA_HOME=`/usr/libexec/java_home -v 1.7`
           fi

That -v 1.7 will only find exactly 1.7. It looks like it should be 1.7+, to accept 1.7 or newer.

Should probably do similar in the [current logic]: it's looking for 1.8; maybe it should look for 1.8+.

Discovered this while trying to upgrade the Neo4j version in Mac Homebrew.

@sonu27
Copy link

sonu27 commented Mar 5, 2018

Same thing happens if you have Java 1.9 installed. Why do I need to downgrade to 1.8?

@apjanke
Copy link
Author

apjanke commented Mar 5, 2018

Java 9 is a significant change over Java 8, and Oracle has recently moved to a more aggressive 6 month release + "LTS" release cycle for the JDK. Now, you need to make more considered changes when migrating to a new version of the JDK, and it's reasonable for libraries to stick with older JDK versions. See http://www.oracle.com/technetwork/java/eol-135779.html and Google results for "Java LTS" for more details.

@spacecowboy
Copy link
Contributor

At this time Neo4j is not Java9 compatible

@zinnov-manu
Copy link

As @apjanke said, appending + to the version will solve the issue.

@apjanke
Copy link
Author

apjanke commented Nov 16, 2018

Hold on there: if Neo4J is not Java 9 compatible as @spacecowboy says, unfortunately it's a bit more complex, and just adding a "+" won't solve. Neo4j needs either Java 1.7 or 1.8, not earlier and not later. That requirement can't be exactly specified in a single /usr/libexec/java_home argument. Unfortunately, as things stand now, you probably have to do a couple calls to /usr/libexec/java_home with both 1.7+ and 1.8- as arguments, and reconcile the results of the two.

@zinnov-manu
Copy link

Hold on there: if Neo4J is not Java 9 compatible as @spacecowboy says, unfortunately it's a bit more complex, and just adding a "+" won't solve. Neo4j needs either Java 1.7 or 1.8, not earlier and not later. That requirement can't be exactly specified in a single /usr/libexec/java_home argument. Unfortunately, as things stand now, you probably have to do a couple calls to /usr/libexec/java_home with both 1.7+ and 1.8- as arguments, and reconcile the results of the two.

As I see from neo4j 3.4.10, it checks for a version above 1.8 as can be seen below:

if [[ "${JAVA_VERSION}" < "1.8" ]]; then
echo "ERROR! Neo4j cannot be started using java version ${JAVA_VERSION}. "
_show_java_help
exit 1

However in later part of the code it checks for a version that matches exactly 1.8

_find_java_home() {
[[ "${JAVA_HOME:-}" ]] && return

case "${DIST_OS}" in
"macosx")
JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
;;
"gentoo")
JAVA_HOME="$(java-config --jre-home)"
;;
esac
}

Here the error would be thrown as Unable to find any JVMs matching version "1.8"

Changing this to 1.8+ solved the issue for me . Am having Java version 11 AND neo4j 3.4.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants