Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-03-2020 03:31 AM
Hi,
I have two versions of Java at my server 1.8 and 11 (other apps require 1.8)
For neo4j.bat I simply set java_home inserting line:
SET "JAVA_HOME=C:\Program Files\Java\jdk-11.0.4"
How to manage it for neo4j install-service?
Where I should set java_home? Tried $javaPath = 'C:\Program Files\Java\jdk-11.0.4' and '$javaCMD = 'C:\Program Files\Java\jdk-11.0.4\bin'' in Get-Java.ps1 yet it does not work. Same about ' $javaPath = 'C:\Program Files\Java\jdk-11.0.4' in this file.
Regards
Solved! Go to Solution.
10-13-2020 09:07 AM
I think it is being set automatically only once during the service creation based on the JAVA_HOME environment variable value that is set at that time, after which JAVA_HOME is ignored by the service (but, obviously, it is still being respected by the CLI executions of Neo4j commands).
Initially my Neo4j service was created with JAVA_HOME set to OpenJDK 14.
Then I installed Oracle JDK 1.8 and set JAVA_HOME to it because other software required it.
Neo4j happily kept using OpenJDK 14, according to ProcessExplorer.
What I tried to do is to run <neo4j_home>\bin\neo4j uninstall-service
with the new JAVA_HOME setting and it did not let me, complaining about the JRE version compatibility with Neo4j. This served as the extra proof that up until that point the service was starting Neo4j using the old, somehow preserved, JAVA_HOME setting.
So I think the right sequence of steps is the following:
<neo4j_home>\bin\neo4j uninstall-service
<neo4j_home>\bin\neo4j install-service
to re-create the Neo4j serviceP.S. I could not find a neo4j.conf
setting for this, which is strange. Maybe this inability to change the location of a JRE for an already created and tested system service was the intentional protection against silly people?
03-03-2020 11:30 AM
You need to set path in environment variable of system.
go to mycomputer's properties and check environment variable
03-03-2020 01:18 PM
Read the post before you answer.
10-13-2020 09:07 AM
I think it is being set automatically only once during the service creation based on the JAVA_HOME environment variable value that is set at that time, after which JAVA_HOME is ignored by the service (but, obviously, it is still being respected by the CLI executions of Neo4j commands).
Initially my Neo4j service was created with JAVA_HOME set to OpenJDK 14.
Then I installed Oracle JDK 1.8 and set JAVA_HOME to it because other software required it.
Neo4j happily kept using OpenJDK 14, according to ProcessExplorer.
What I tried to do is to run <neo4j_home>\bin\neo4j uninstall-service
with the new JAVA_HOME setting and it did not let me, complaining about the JRE version compatibility with Neo4j. This served as the extra proof that up until that point the service was starting Neo4j using the old, somehow preserved, JAVA_HOME setting.
So I think the right sequence of steps is the following:
<neo4j_home>\bin\neo4j uninstall-service
<neo4j_home>\bin\neo4j install-service
to re-create the Neo4j serviceP.S. I could not find a neo4j.conf
setting for this, which is strange. Maybe this inability to change the location of a JRE for an already created and tested system service was the intentional protection against silly people?
06-07-2021 01:47 PM
For Linux services you can chose to only set java 11 for neo4j and or this you need to edit the service configuration file
systemctl edit neo4j
Force the environment variable when your service starts
[Service]
# Set the JAVA_HOME to java 11
#(consider future upgrade of java 11 since this is an absolute path )
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.11.0.9-2.el8_4.x86_64/"
# The user and group which the service runs as.
User=neo4j
Group=neo4j
# If it takes longer than this then the shutdown is considered to have failed.
# This may need to be increased if the system serves long-running transactions.
TimeoutSec=120
All the sessions of the conference are now available online