我想用Java中的HypergraphDB做些事情。我对这种语言和IDE Netbeans不太熟悉。
我按照描述HGDB安装的步骤操作:Link to tutorial
现在,我想用Java(使用NetbeansIDE)编写一个示例。

因此,我创建了一个新项目,对下载的库添加了参考。好的,现在我可以使用HGDB导入软件包了。我在main方法中唯一拥有的是HyperGraph HG = new HyperGraph(dbLocation);。这段代码会编译。但是出现以下运行时错误:

    run:
checkpoint kbytes:0
checkpoint minutes:0
java.lang.IllegalStateException: There is 1 existing transaction opened against the Environment.
Aborting open transactions ...
aborting <Transaction id="28">
    at com.sleepycat.je.Environment.close(Environment.java:383)
    at org.hypergraphdb.storage.bje.BJEStorageImplementation.shutdown(BJEStorageImplementation.java:178)
    at org.hypergraphdb.HGStore.close(HGStore.java:355)
    at org.hypergraphdb.HyperGraph.open(HyperGraph.java:392)
    at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
    at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
    at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Exception in thread "main" org.hypergraphdb.HGException: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
    at org.hypergraphdb.HyperGraph.open(HyperGraph.java:395)
    at org.hypergraphdb.HyperGraph.open(HyperGraph.java:213)
    at org.hypergraphdb.HyperGraph.<init>(HyperGraph.java:200)
    at hgdbtest.HgdbTest.main(HgdbTest.java:16)
Caused by: java.lang.NoSuchMethodError: org.hypergraphdb.storage.bje.LinkBinding.objectToEntry(Ljava/lang/Object;Lcom/sleepycat/je/DatabaseEntry;)V
    at org.hypergraphdb.storage.bje.BJEStorageImplementation.store(BJEStorageImplementation.java:234)
    at org.hypergraphdb.HGStore.store(HGStore.java:119)
    at org.hypergraphdb.HGTypeSystem.addPrimitiveTypeToStore(HGTypeSystem.java:185)
    at org.hypergraphdb.HGTypeSystem.bootstrap(HGTypeSystem.java:234)
    at org.hypergraphdb.HyperGraph.open(HyperGraph.java:355)
    ... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 4 seconds)


我猜这是由BerkeleyDB的本地API引起的。

根据教程,在项目选项中,我在运行卡上将-Djava.library.path=$HGDB_ROOT/lib/native/$PLATFORM参数作为VM选项提供。我使用系统的完整路径而不是系统变量。
Windows7中的我的操作系统。我不确定使用斜杠或反斜杠或双反斜杠作为路径分隔符。

因此,一个简单的问题是:如何为使用HypergraphDB设置IDE?

谢谢您的指教!

最佳答案

从堆栈跟踪来看,您正在使用最新版本的HyperGraphDB。在该版本中,未使用本机API。而是仅Java库。您必须在运行时类路径中包含BerkeleyDB Java Edition 5.0.34 jar。您可以从Oracle http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html或HyperGraphDB Maven存储库中获取它:http://hypergraphdb.org/maven/org/hypergraphdb/hgbdbje/1.2/hgbdbje-1.2.jar

10-04 20:56