Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which jars exactly are needed to embed Neo4j?

EDIT This question is not about how to solve dependencies using Ant / Maven / Gradle or whatnots.

I'm trying to use Neo4j and I'm a bit confused by the docs as to what I need to embed a very simple "Hello, world!" Neo4j example in an app.

I've read in several places that Neo4j was lightweight and that only one (and now two) jars where needed.

For example here: http://highscalability.com/neo4j-graph-database-kicks-buttox

we can read: "Small footprint. Neo4j is a single <500k jar with one dependency (the Java Transaction API)."

This is precisely one of the reason I'm interested in Neo4j to embed it...

So I downloaded the community edition (GPL) of Neo4j and read the explanation here:

http://docs.neo4j.org/chunked/stable/tutorials-java-embedded-setup.html

which says: "Extract a Neo4j download zip/tarball, and use the jar files found in the lib/ directory."

Now that's more than concise and I've found old messages saying that the "wording was changed". At one point all that Neo4j needed was one jar apparently (which is one of the reason I was interested in embedding Neo4j btw). But now apparently it's two, because there's a dependency on some Java Transaction API (which one? a .jar shipped with neo4j?)

The problem is that if I look in that lib/ dir I've got quite some things:

1115454 lib/neo4j-kernel-1.6.1.jar
153707  lib/neo4j-graph-algo-1.6.1.jar
222791  lib/neo4j-shell-1.6.1.jar
8865464 lib/scala-library-2.9.0-1.jar
43530   lib/neo4j-jmx-1.6.1.jar
590503  lib/neo4j-kernel-1.6.1-tests.jar
23954   lib/neo4j-community-1.6.1.jar
28023   lib/neo4j-udc-1.6.1.jar
1517975 lib/neo4j-cypher-1.6.1.jar
51662   lib/neo4j-graph-matching-1.6.1.jar
16030   lib/geronimo-jta_1.1_spec-1.1.1.jar
143177  lib/neo4j-lucene-index-1.6.1.jar
1466301 lib/lucene-core-3.5.0.jar
118875  lib/server-api-1.6.1.jar
92850   lib/org.apache.servicemix.bundles.jline-0.9.94_1.jar

And in system/lib:

27461   system/lib/blueprints-neo4j-graph-1.1.jar
72650   system/lib/jettison-1.3.jar
628626  system/lib/rrd4j-2.0.7.jar
17985   system/lib/asm-analysis-3.2.jar
177174  system/lib/jetty-util-6.1.25.jar
109043  system/lib/commons-io-1.4.jar
755981  system/lib/neo4j-server-1.6.1.jar
35910   system/lib/gremlin-java-1.4.jar
46367   system/lib/jsr311-api-1.1.1.jar
36551   system/lib/asm-util-3.2.jar
206035  system/lib/commons-beanutils-core-1.8.0.jar
227122  system/lib/jackson-core-asl-1.8.3.jar
33094   system/lib/asm-commons-3.2.jar
17308   system/lib/jcl-over-slf4j-1.6.1.jar
21878   system/lib/asm-tree-3.2.jar
12359   system/lib/log4j-over-slf4j-1.6.1.jar
.
.   (skipped a few jars from system/lib here)
.  

If my Emacs-fu is strong enough the jars above weight at nearly 17 MB (not that "embeddable")... And I didn't even paste all the jars from system/lib/.

So what is the minimum number of .jar (and which are they) do I need so that I can embed Neo4j and run a simple "Hello, world!" example?

I'm confused by the official doc saying: "... use the jar files found in the lib/ directory".

Surely I don't need all of them right?

like image 742
Cedric Martin Avatar asked Mar 17 '12 17:03

Cedric Martin


People also ask

Is Neo4j embedded?

It enhances the functionality of the “host” application, usually without the end user realizing they are engaging with the embedded database. In this blog series, we'll discuss how Neo4j can be used as an embedded database.

What protocol does a Java application use to access the Neo4j database?

The Neo4j Java driver is officially supported by Neo4j and connects to the database using the binary protocol.

Is Neo4j Java based?

Neo4j is implemented in Java and accessible from software written in other languages using the Cypher query language through a transactional HTTP endpoint, or through the binary "Bolt" protocol.The "4j" in Neo4j is a reference to its being built in Java, however is now largely viewed as an anachronism.

What is Neo4j graph database?

Neo4j is an open-source, NoSQL, native graph database that provides an ACID-compliant transactional backend for your applications that has been publicly available since 2007.


2 Answers

Basically, you need only neo4j-kernel-1.6.1.jar (and the mentioned transaction API geronimo-jta_1.1_spec).

However, this will give you only the basic functionality. If you want to use other parts, like indexing, querying, management tools, etc., you would need other jars.

like image 187
Bozho Avatar answered Oct 09 '22 05:10

Bozho


The absolute minimum to run the kernel is

neo4j-kernel.jar
jta.jar

The rest is Cypher, Lucene indexing and other stuff.

like image 43
Peter Neubauer Avatar answered Oct 09 '22 03:10

Peter Neubauer