I have a rexster server running locally on my machine on port 8984. I want to connect to my graph dadabase (orientdb) and execute gremlin scripts within my java code. I couldn't find any good example or tutorial on doing that.
Here is my code:
import com.tinkerpop.rexster;
import com.tinkerpop.rexster.*;
public class Orient {
public static void main(String[] args) {
RexsterClient client = RexsterClientFactory.open("localhost", 8984);
String script = String.format("g=rexster.getGraph('%s');g.v('%s').map", "test_test", "9:6267");
List<Map<String, Object>> results = client.execute(script);
Map<String, Object> map = results.get(0);
System.out.println(map.get("name"));
}
}
when I try to compile my code like :
$javac -cp rexster-protocol-2.6.0.jar Orient.java
I get this :
Orient.java:1: error: package com.tinkerpop does not exist
import com.tinkerpop.rexster;
^
Orient.java:2: error: package com.tinkerpop.rexster does not exist
import com.tinkerpop.rexster.*;
^
Orient.java:7: error: cannot find symbol
RexsterClient client = RexsterClientFactory.open("localhost", 8984);
^
symbol: class RexsterClient
location: class Orient
what am I doing wrong? where can I get the dependencies (.jar) files. if any needed.
Thanks
You need to add all dependent jar files in classpath to compile
http://mvnrepository.com/artifact/com.tinkerpop.rexster/rexster-protocol/2.6.0
You would better use maven or gradle build tool rather downloading all the jar files and typing compile command manually.