Getting Neo4j to install as a service on Windows 8 Release Preview x64

So, I’ve been working out how to get Neo4j installed on my Windows 8 machine.

The j in neo4j does indeed stand for Java, and so I installed the JDK and JRE for my system (x64), and then I extracted neo4j to a suitable directory, (e:\Databases\Neo4j) and went to run the server to get some hot graphdb action… so I run:

bin\neo4j.bat

AS is detailed in the online instructions… BAM! No dice… turns out I was missing a NEO4J_HOME environment variable… OK, we add that bad boy in, pointing to the unzip location..

bin\neo4j.bat

YEH! We’re in…

Now, that all works, but I’d rather have it as a service, I don’t want the Java window up all the time… so

bin\neo4j.bat install

[SC]  CreateService Success

[SC] StartService FAILED 2:

The system cannot find the file specified.

eh? It runs fine otherwise…

What is it trying to run?

Editing the neo4j.bat file, we discover it calls the base.bat file, so.. let’s edit the base.bat file…

A quick CTRL+F search for ‘install’ a couple of ‘Find Nexts’ later, and we hit paydirt…

rem

rem function install

rem

:install

The next line begins ‘set binpath=….’ now, I’m pretty lazy when it comes to my ‘bothered to hunt out a problem’ and if there is a cheat way to go, I will! So – I could read the line, understand where all the bits are, or…. copy it, paste it above and put echo in front of it…

When I next run my install, I get this line:

set binPath="C:\Program Files\bin\java.exe….

that doesn’t look right… a quick look in c:\program files proves that yes – I don’t have a ‘bin’ folder in there… so.. in the bat file I note it’s looking for %javaPath%, trusty CTRL+F to the rescue and we end up at a section entitled:

:findJavaHome

which uses the Environment variable ‘JAVA_HOME’. In the command prompt, a quick:

set Java_home

tells me that this is NOT set anywhere.

So, I add the JAVA_HOME environment variable pointing to: C:\Program Files\Java\jre7

Run

neo4j.bat uninstall

To tidy up you understand, and then

neo4j.bat install

 

And we’re cooking!

Print | posted @ Friday, July 27, 2012 5:00 PM

Comments on this entry:

Gravatar # re: Getting Neo4j to install as a service on Windows 8 Release Preview x64
by Peter Neubauer at 8/1/2012 1:19 AM

Cool!

Anything we could improve on http://docs.neo4j.org/chunked/snapshot/server-installation.html#_as_a_windows_service to make this obvious?
Gravatar # re: Getting Neo4j to install as a service on Windows 8 Release Preview x64
by Chris at 8/1/2012 1:26 AM

I would only put something about checking that NEO4J_HOME exists, I certainly didn't do:

cd %neo4j_home%

I just did:

cd databases\neo4j\

instead. I was surprised Java didn't create a JAVA_HOME environment variable as well, but it's worth mentioning that you need to look for that as well, as the error message you get:

"The system cannot find the file specified."

isn't so handy :)
Post A Comment
Title:
Name:
Email:
Comment:
Verification: