Database Reference
In-Depth Information
Embedding Neo4j in Java applications
Embedding Neo4j in a Java application should not be confused with the in-memory data-
base. However, Neo4j exposes all the required APIs to deploy the server as an embedded
application or configure it as in-memory database.
Execute the following steps to configure and run Neo4j as an embedded server within your
existing applications:
1. Choose the appropriate Neo4j Edition—Community or Enterprise (refer to the Li-
censing options section in Chapter 1 , Installation and the First Query ).
2. You can either manually configure your project or use Maven to configure it. Here
we will define the steps to configure Maven-based Java projects; but later in this
section, we will also talk about the process to set up Java projects manually using
an Integrated Development Environment ( IDE ) such as Eclipse— ht-
tps://eclipse.org/ , Intellij IDEA— https://www.jetbrains.com/idea/ , NetBeans— ht-
tps://netbeans.org/ , and so on. Perform the following steps to create a Maven pro-
ject:
1. Download Maven 3.2.3 from http://maven.apache.org/download.cgi .
2. Once the archive is downloaded, browse the directory on your filesystem
and extract it.
3. Define the system environment variable M2_HOME=<location of
extracted Archive file > .
4. Add $M2_HOME/bin/ to your $PATH variable.
5. Next, open your console and browse the location where you want to create
your new Maven project and execute:
mvn archetype:generate
-DgroupId=neo4j.embedded.myserver
-DartifactId=MyNeo4jSamples
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
6. It will take some time as Maven will download the required dependencies
to create your project. You will see a MyNeo4jSamples directory being
created as soon as the project is created.
7. Edit the MyNeo4jSamples/pom.xml file and add the following piece
of code under the dependencies section for defining the dependencies of
the Neo4j libraries:
Search WWH ::




Custom Search