Использование Neo4j, встроенного в приложения Java
Я пытаюсь использовать Neo4j, встроенный в приложения Java, и я использую этот код:
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();
}
}
}
Но я получил это исключение:
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
Любая идея, пожалуйста
1 ответ
newEmbeddedDatabase
ожидать File
в качестве аргумента
GraphDatabaseService db = dbFactory.newEmbeddedDatabase(new File("C:/TPNeo4jDB"));