In the previous post I’ve written about new features in Neo4j. One of the new game changing functions were stored procedures. But, as I experienced, getting them to run on a Windows / .NET environment wasn’t that easy, and I was seeing “There is no procedure with the name …” more often then I wished for. So here is a short how to. Hope to save you some googling.
-
JDK
-
Download and install JDK 8.x from here. I’ve used 8u92 version.
-
Set environment variable for
JAVA_HOME
pointing to JDK install location (in my caseC:\Program Files\Java\jdk1.8.0_92
). This can be done with some PowerShell:[Environment]::SetEnvironmentVariable("JAVA_HOME","C:\Program Files\Java\jdk1.8.0_92","Machine")
The last parameter sets it as a machine level variable (visible for all users).
-
-
Install Maven
- Download Maven from the official site
- Unzip it to a directory. In my case
C:\Program Files\Maven
- Add environment variables for
M2_HOME
andMAVEN_HOME
.[Environment]::SetEnvironmentVariable("M2_HOME","C:\Program Files\Maven","Machine")
[Environment]::SetEnvironmentVariable("MAVEN_HOME","C:\Program Files\Maven","Machine") -
Update
PATH
environment.$path=[Environment]::GetEnvironmentVariable("Path","Machine")
if($path -notcontains "%M2_HOME%\bin"){
$newPath=$path+";"+ "%M2_HOME%\bin"
[Environment]::SetEnvironmentVariable("Path",$newPath,"Machine")
}
- Check. Run
mvn -version
in a new cmd.
-
Neo4j
- If you haven’t, download the new Neo4j version (stored procedures are available in version 3.0 and up) from here.
- Add
NEO4J_HOME
environment path for Neo4j folder(in my caseC:\Program Files\Neo4j CE 3.0.0
).[Environment]::SetEnvironmentVariable("NEO4J_HOME","C:\Program Files\Neo4j CE 3.0.0","Machine")
- Clone
neo4j-apoc-procedures
. Again some PowerShell - should be executed with admin privileges:git clone http://github.com/jexp/neo4j-apoc-procedures
cd neo4j-apoc-procedures
mvn clean install
copy target/apoc-1.0.0-SNAPSHOT.jar $Env:NEO4J_HOME/plugins/ -
Edit Neo4j config.
Open
%userprofile%\AppData\Roaming\Neo4j Community Edition
and add this entry (change the path if yours was different then in point 3.1):dbms.directories.plugins=c:/Program\ Files/Neo4j\ CE\ 3.0.0/plugins
- Restart Neo4j (if it was running)
- Check if it is OK and enter for example
call apoc.help('search')
in Neo4j cmd. And this should appear: