Neo4j 2.3.3
OS X 10.11.4; OS X 10.9.5; OS X 10.1.
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.
Same thing happens if you have Java 1.9 installed. Why do I need to downgrade to 1.8?
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.
At this time Neo4j is not Java9 compatible
As @apjanke said, appending + to the version will solve the issue.
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.
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_homeargument. Unfortunately, as things stand now, you probably have to do a couple calls to/usr/libexec/java_homewith both1.7+and1.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
Most helpful comment
At this time Neo4j is not Java9 compatible