The Neo4j server was starting just fine... Then I uninstalled and re-installed Java (to deal with another issue), and now the Neo4j server cannot even start!
Operating system: Windows 10
Steps to reproduce
1) Start the Windows10 Power Shell
2) Issue the command D:\neo4j\bin\neo4j console ( D:\neo4j is my Neo4j install directory)
`
Invoke-Neo4j : Could not find java at C:\Program Files (x86)\Java\jdk1.8.0_181\bin\java.exe
At line:1 char:163
... ule 'D:\neo4j\bin\Neo4j-Management.psd1'; Exit (Invoke-Neo4j console)
~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-Neo4j
`
I don't even know where it's dreaming up the _C:\Program Files (x86)\Java_ part - Java is installed on C:\Program Files\Java (as expected for a 64-bit version)
The Windows 10 control panel is showing "Java SE Development Kit 8 Update 181" and "*Java SE Development Kit 8 Update 181 (64-bit)
*". Note: I just uninstalled and re-installed Java, but it didn't help
PS: I took a peek at the Windows registry, and didn't notice anything immediately looking abnormal. For example, it shows JavaHome to be set to C:\Program Files\Java\jre1.8.0_181 , which looks good. And none of the registry entries under JavaSoft show that mysterious _C:\Program Files (x86)_ folder that shouldn't be there...
I managed to hack my way around this issue by going into NEO4J_HOME\bin\Neo4j-Management\Get-Java.ps1 and changing the line:
$javaPath = ''
to
$javaPath = 'C:\Program Files\Java\jdk1.8.0_181' _(the actual location of Java in my machine)_
Is there a way for a user not to have to drill down into that file? Could the $javaPath be set in the general configuration file? Or better yet extracted from the registry?
It appears that Get-Java.ps1 is indeed poking around the Windows registry, but apparently looking in the wrong places...
I did a search in the registry for that incorrect C:\Program Files (x86)\Java , and managed to find it only under Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment\JAVA_HOME , and under Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\JAVA_HOME . Neither of those are editable.
I tried to locate any string containin "ControlSet" in the Get-Java.ps1 file, but none is present. So, I'm still mystified by how that incorrect C:\Program Files (x86)\Java got conjured up at all during the attempt to start the Neo4j server...
I was getting "Could not locate JVM.DLL at C:\Program Files (x86)\Java\jre1.8.0_231\bin\server\jvm.dll" and resolved it by:
Making a copy of the "C:\Program Files (x86)\Java\jre1.8.0_231\bin\client" folder and renaming it "C:\Program Files (x86)\Java\jre1.8.0_231\bin\server"
Problem went away
Check your JAVA_HOME system variable. The path may have changed.
Check how to do so here:
https://www.google.com.sg/amp/s/javatutorial.net/set-java-home-windows-10/amp
我收到“无法在C:\ Program Files(x86)\ Java \ jre1.8.0_231 \ bin \ server \ jvm.dll中找到JVM.DLL”并通过以下方法解决了问题:
复制“ C:\ Program Files(x86)\ Java \ jre1.8.0_231 \ bin \ client”文件夹并将其重命名为“ C:\ Program Files(x86)\ Java \ jre1.8.0_231 \ bin \ server ”
问题消失了
I don't have"C:\ Program Files(x86)\ Java \ jre1.8.0_231 \ bin \ client" this filies,So can I do what to solve the problem?
Most helpful comment
I managed to hack my way around this issue by going into
NEO4J_HOME\bin\Neo4j-Management\Get-Java.ps1and changing the line:$javaPath = ''to
$javaPath = 'C:\Program Files\Java\jdk1.8.0_181'_(the actual location of Java in my machine)_Is there a way for a user not to have to drill down into that file? Could the $javaPath be set in the general configuration file? Or better yet extracted from the registry?
It appears that
Get-Java.ps1is indeed poking around the Windows registry, but apparently looking in the wrong places...I did a search in the registry for that incorrect
C:\Program Files (x86)\Java, and managed to find it only underComputer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment\JAVA_HOME, and underComputer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\JAVA_HOME. Neither of those are editable.I tried to locate any string containin "ControlSet" in the
Get-Java.ps1file, but none is present. So, I'm still mystified by how that incorrectC:\Program Files (x86)\Javagot conjured up at all during the attempt to start the Neo4j server...