我正在尝试使用java中的neo4j:
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Label;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
public class tests {
public enum nodetype implements Label
{
Student,teacher;
}
public static void main(String[] args) {
GraphDatabaseFactory dbfactory=new GraphDatabaseFactory();
GraphDatabaseService graphdb =dbfactory.newEmbeddedDatabase("C:\\Users\\Zigzago\\.Neo4jDesktop\\neo4jDatabases\\database-f308fc06-68df-4463-841d-fb3ab98b1b08\\installation-3.3.3\\data\\databases\\graph.db");
try(Transaction tx=graphdb.beginTx())
{
Node s= graphdb.createNode(nodetype.Student);
s.setProperty("Pid",5001);
tx.success();
}
catch (Exception ex)
{
String message = ex.getMessage();
}
graphdb.shutdown();
}
}
和pom.xml是
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>neo4jtest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.1.6</version>
</dependency>
</dependencies>
</project>
但是我收到以下错误:
无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 项目neo4jtest上的(default-cli):命令执行失败。处理 退出时出错:1(退出值:1) - &gt; [帮助1]
要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven 使用-X开关重新运行Maven以启用完整的调试日志记录。
有关错误和可能的解决方案的更多信息,请阅读以下文章:
[帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
知道iam使用netbeans8.1和jdk:java版本&#34; 1.8.0_144&#34;