准备绘制知识图谱,在安装java11.0.10和neo4j后,进行启动,一直出现图片中的问题,改过环境配置还是不行,不理解哪里的问题
import org.neo4j.driver.v1.*;
import static org.neo4j.driver.v1.Values.parameters;
/**
* @Auther: guguda
* @Date: 2019/4/17 15:48
* @Description:
*/
public class SmallExample {
//Driver objects are thread-safe and are typically made available application-wide.
//驱动程序对象是线程安全的,通常在应用程序范围内可用。
Driver driver;
public SmallExample(String uri,String user,String password){
driver=GraphDatabase.driver(uri,AuthTokens.basic(user,password));
}
private void addPerson(String name){
// Sessions are lightweight and disposable connection wrappers.
//会话是轻量级的一次性连接包装器。
Session session = driver.session();
// Wrapping Cypher in an explicit transaction provides atomicity
//在显式事务中包装cypher提供原子性
// and makes handling errors much easier.
//并使处理错误更加容易。
try(Transaction tx = session.beginTransaction())
{
{
tx.run("MERGE (a:Person {name: {x}})", parameters("x", name));
tx.success();// Mark this write as successful.
//将此写入标记为成功。
}
}
}
private void printPeople(String initial){
try (Session session = driver.session()){
// Auto-commit transactions are a quick and easy way to wrap a read.
//自动提交事务是一种快速简单的包装读取的方法。
StatementResult result = session.run(
"MATCH (a:Person) WHERE a.name STARTS WITH {x} RETURN a.name AS name",
parameters("x", initial));
// Each Cypher execution returns a stream of records.
//每个Cypher执行返回一个记录流。
while (result.hasNext())
{
Record record = result.next();
// Values can be extracted from a record by index or name.
//Values可以按索引或名称从记录中提取值。
System.out.println(record.get("name").asString());
}
}
}
public void close(){
// Closing a driver immediately shuts down all open connections.
//关闭驱动程序会立即关闭所有打开的连接。
driver.close();
}
public static void main(String[] args)
{
SmallExample example = new SmallExample("bolt://192.168.34.7:7687", "neo4j", "guguda007");
example.addPerson("Ada");
example.addPerson("Alice");
example.addPerson("Bob");
example.printPeople("A");
example.close();
}
}
看这个报错
检查你的Java安装路径是不是这个,Java环境变量是否配置,看下这个bat脚本里面是否指定了Java的路径,如果不是你的Java安装路径,你需要将其替换为你的java安装路径