Reputation: 79
I am trying to use Neo4j embedded in Java applications, and I am using this code:
package com.tp.neo4j.java.examples;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
public class Neo4jJavaAPIDBOperation {
public static void main(String[] args) {
GraphDatabaseFactory dbFactory = new GraphDatabaseFactory();
GraphDatabaseService db = dbFactory.newEmbeddedDatabase("C:/TPNeo4jDB");
try (Transaction tx = db.beginTx()) {
// Perform DB operations
tx.success();
}
}
}
But I got this Exception:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method newEmbeddedDatabase(File) in the type GraphDatabaseFactory is not applicable for the arguments (String)
Syntax error on token ";", try expected after this token
any idea, please
Upvotes: 2
Views: 309
Reputation: 374
newEmbeddedDatabase
expect File
as argument
GraphDatabaseService db = dbFactory.newEmbeddedDatabase(new File("C:/TPNeo4jDB"));
Upvotes: 2