pangguoming pangguoming - 11 months ago 68
Java Question

when i do a simple program with Neo4j java api , i get the following error

  1. My java version:java version "1.8.0_25"
    Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
    Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

  2. My Neo4j version: neo4j-community-2.3.0-RC1

  3. I imported all jar files in 'neo4j-community-2.3.0-RC1\lib' direcory to classpath with Eclipse

  4. I can find the messages.log file in "C:/TPNeo4jDB", the log is:
    2015-10-15 06:19:03.151+0000 INFO [o.n.k.i.f.CommunityFacadeFactory] No locking implementation specified, defaulting to 'community'

  5. I use windows 8 now

When my program runs
GraphDatabaseService db = dbFactory.newEmbeddedDatabase("C:/TPNeo4jDB");

I get error:

Exception in thread "main" java.lang.NullPointerException
at org.neo4j.kernel.impl.factory.CommunityEditionModule.determineEdition(
at org.neo4j.kernel.impl.factory.CommunityEditionModule.publishEditionInfo(
at org.neo4j.kernel.impl.factory.CommunityEditionModule.(
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.createEdition(
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(
at com.gongjiaolaile.view.Test.main(


I guess that you are missing some libraries. First of all there are several places in Neo4j directory with libraries:

  • lib/
  • system/lib/

Second one - you should use build management tool like Maven.

In Neo4j documentation there is Using Neo4j embedded in Java applications section, that gives you overview how to use Neo4j. And here is described how to add Neo4j as dependency.