Hi,
I have problems with starting Neo4J on a server with 256GiB of RAM.
$ ./neo4j-community-2.1.5/bin/neo4j start
ERROR! Neo4j cannot be started using java version .
* Please use Oracle(R) Java(TM) 7 or OpenJDK(TM) to run Neo4j Server.
* Please see
http://docs.neo4j.org/ for Neo4j Server installation instructions.
The problem comes from the checkjvmcompatibility function in ./bin/utils,
as it tries to run JVM without giving initial and maximum heap size.
Due the large amount of RAM in the server, JVM tries to allocate to many GiB
which are not always free.
# check if running Oracle JDK 7 or OpenJDK 7, warn if not
checkjvmcompatibility() {
# Shut down if java version < 1.7
JAVAVERSION=$("$JAVACMD" ${JAVA_OPTS} -version 2>&1 | awk -F '"' '/version/ {print $2}')
if [[ "$JAVAVERSION" < "1.7" ]]; then
complain_about_java_version
#exit 1
fi
$JAVACMD ${JAVA_OPTS} -version 2>&1 | egrep -q "(Java HotSpot\\(TM\\)|OpenJDK) (64-Bit Server|Server|Client) VM"
if [ $? -eq 1 ]
then
warn_about_java_runtime
fi
}
After fixing the function to the following, I can start Neo4J correctly.
# check if running Oracle JDK 7 or OpenJDK 7, warn if not
checkjvmcompatibility() {
# Get Java version output
JAVAVERSIONOUTPUT=$("$JAVACMD" -Xms10M -Xmx10M -version 2>&1)
# Check if JVM was able to start correctly.
if [ $? -ne 0 ] ; then
echo 'ERROR: Problem with starting JVM.'
exit 1
fi
# Shut down if java version < 1.7
JAVAVERSION=$(echo "$JAVAVERSIONOUTPUT" | awk -F '"' '/version/ {print $2}')
if [[ "$JAVAVERSION" < "1.7" ]]; then
complain_about_java_version
exit 1
fi
echo "$JAVAVERSIONOUTPUT" | egrep -q "(Java HotSpot\\(TM\\)|OpenJDK) (64-Bit Server|Server|Client) VM"
if [ $? -eq 1 ]
then
warn_about_java_runtime
fi
}
According to the manual of grep: egrep is deprecated, so it might be better to use grep -E instead:
In addition, three variant programs egrep, fgrep and rgrep are available.
egrep is the same as grep -E.
fgrep is the same as grep -F.
rgrep is the same as grep -r.
Direct invocation as either egrep or fgrep is deprecated, but is
provided to allow historical applications that rely on them to run
unmodified.
Kind regards,
Gert Hulselmans