0

I am having trouble accessing a JanusGraph instance. The documents show sample code such as the following:

Graph graph = EmptyGraph.instance();
GraphTraversalSource g =
    graph.traversal().withRemote("conf/remote-graph.properties");

and it works, but what I want is to get a JanusGraph instance, because almost all the examples given on the internet are based on JanusGraph instance, including the official examples and the bulk import utils, e.g.,

so I found another page about it. I then tried the following:

GraphTraversalSource g = 
    JanusGraphFactory.open("inmemory").traversal().withRemote(config);

but when i do this, the procedures end up with:

ClassNotFindException: OptionSteps.class

So I wonder, how can I get the JanusGraph instance in my Java code? The code is running on Windows, and the JanusGraph is running on a Linux server—does it matter? Do I have to run them together to find the OptionSteps class?

Misha Brukman
  • 12,938
  • 4
  • 61
  • 78
  • Thank you for you help! And I thought there might be something wrong with the dependence org.janusgraph.janusgraph-all, version 0.3.2.This dependence does not provide a class OptionalSteps. The Exception is ClassNotDefineError,not ClassNotFindException.When I change to the version 0.2.0, my code works. so,the JanusGraph instance is provided for the JanusGraph embeded mode and the inmemory mode? – Tony IronMan Jul 24 '19 at 12:55

1 Answers1

1

Regarding the dependencies, the correct artifact is janusgraph-core and you can see an example usage in the JanusGraph project itself.

<dependency>
    <groupId>org.janusgraph</groupId>
    <artifactId>janusgraph-core</artifactId>
    <version>0.3.2</version>
</dependency>

This dependency is also mentioned in Connecting from Java in the JanusGraph docs.

Misha Brukman
  • 12,938
  • 4
  • 61
  • 78
Jason Plurad
  • 6,682
  • 2
  • 18
  • 37