I am trying to connect to my localhost (Neo4J database) from an Android application.
The way to do this, is using a few libraries:
- neo4J-rest-graphdb-1.8.1.jar
- neo4J-rest-graphdb-1.8.1-javadoc-.jar
- neo4J-rest-graphdb-1.8.1-sources.jar
- neo4J-rest-graphdb-1.8.1-test-sources.jar
- neo4J-rest-graphdb-1.8.1-tests.jar
- neo4j-server-1.8.M03.jar
When I add those libraries to my Java Build Path it can use them to connect to the Neo4J database, like this:
import org.neo4j.rest.graphdb.RestAPI;
import org.neo4j.rest.graphdb.RestAPIFacade;
import org.neo4j.rest.graphdb.query.QueryEngine;
import org.neo4j.rest.graphdb.query.RestCypherQueryEngine;
import org.neo4j.rest.graphdb.util.QueryResult;
RestAPI graphDb = new RestAPIFacade("http://localhost:7474/db/data");
QueryEngine engine=new RestCypherQueryEngine(graphDb);
QueryResult<Map<String,Object>> result = engine.query("create (:Person {name:\"Steve\"}) return n", Collections.EMPTY_MAP);
Iterator<Map<String, Object>> iterator=result.iterator();
if(iterator.hasNext()) {
Map<String,Object> row= iterator.next();
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(getApplicationContext(),"" + row.get("total") , duration);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
The problem is that I keep getting an error: NoClassDefFoundError org.neo4j.rest.graphdb.RestAPIFacade.
I think it's because of missing a jar file for the build path... But I am not sure.. Maybe something else is going wrong. I already tried to install Maven.. But that wont install via the marketplace it says that its missing repositories.
Any help would be great!