{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner
java,nosql,architecture,tips and tricks,tools & methods,neo4j

Solving Problems in Neo4j Shell and Neo4j Desktop

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 org.neo4j.shell.StartClient
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 (http://jline.sourceforge.net) 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 {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks