Book Image

Neo4j Cookbook

By : Ankur goel, Ankur Goel
Book Image

Neo4j Cookbook

By: Ankur goel, Ankur Goel

Overview of this book

Table of Contents (17 chapters)
Neo4j Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Accessing Neo4j from the Java libraries


Java is at the sweet spot when it comes to the Neo4j language bindings, as Neo4j itself is implemented in Java. Most of the other language bindings, which access Neo4j as an embedded application, have been built on Java. In this recipe, we will take a look at the various ways to connect to Neo4j in Java.

In this recipe, we will learn how to access Neo4j in the most powerful way.

Getting ready

Neo4j can be embedded into the Java application, which can provide you with high-performance query results. Follow these steps to embed it into the application:

  1. Neo4j JAR files can be found in the lib directory of the source code. Include all the JAR files present in this directory. Alternatively, the JAR files are also present in the Maven repository.

  2. Add Neo4j to the build path and also add it as a dependency. Detailed information on this can be found at http://docs.neo4j.org/chunked/milestone/tutorials-java-embedded-setup.html.

How to do it...

Let's create our first...