Neo4j: Could not find java at C:\Program Files (x86)\Java\jdk1.8.0_181\bin\java.exe

Created on 19 Oct 2018  ·  4Comments  ·  Source: neo4j/neo4j

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!

  • Neo4j version: Community Edition 3.4.9
  • 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)

  • Expected behavior : start the Neo4j server
  • Actual behavior: error message

`

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)
neo4j startup bug
*
". 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...

team-packaging

Most helpful comment

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...

All 4 comments

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?

Was this page helpful?
0 / 5 - 0 ratings