NoSQL Zone is brought to you in partnership with:

Mark is a graph advocate and field engineer for Neo Technology, the company behind the Neo4j graph database. As a field engineer, Mark helps customers embrace graph data and Neo4j building sophisticated solutions to challenging data problems. When he's not with customers Mark is a developer on Neo4j and writes his experiences of being a graphista on a popular blog at He tweets at @markhneedham. Mark is a DZone MVB and is not an employee of DZone and has posted 553 posts at DZone. You can read more from them at their website. View Full User Profile

Solving Problems in Neo4j Shell and Neo4j Desktop

  • submit to reddit

I’ve been playing around with Neo4j on a Windows VM recently and I wanted to launch neo4j-shell to run a few queries.

The neo4j-shell script isn’t shipped with Neo4j desktop which I used to install Neo4j on my VM but we can still launch it from the Windows Command Prompt with the following command:

C:\Users\Mark> cd "C:\Program Files\Neo4j Community"
C:\Program Files\Neo4j Community>jre\bin\java -cp bin\neo4j-desktop-2.0.0-RC1.jar
Welcome to the Neo4j Shell! Enter 'help' for a list of commands
NOTE: Remote Neo4j graph database service 'shell' at port 1337
Want bash-like features? throw in jLine ( on the classpath

Unfortunately if we start typing in a query we don’t get any feedback as to what we’ve typed, although if we type something syntactically valid and suffix it with a semi colon and press enter it will be evaluated!

e.g. this is the output from entering the following query

START n = node(*) RETURN COUNT(n);
2013 11 29 16 53 56

The reason for the problem is to do with the ‘.shell_history’ file that the shell tries to write to the directory it’s launched from. In this case we don’t have permission to write anything to ‘C:\Program Files\Neo4j Community’ and so we get no feedback.

To work around this problem we need to start the command prompt as an administrator which we can do from the apps menu by right clicking the ‘Command Prompt’ icon:

2013 11 29 17 00 59

Next we click ‘Start as Administrator’ and click through the next screen:

2013 11 29 17 01 14

Now if we launch neo4j-shell and type in our query we get the expected feedback:

2013 11 29 17 04 26

Published at DZone with permission of Mark Needham, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)