我正在尝试运行下面提到的基本neo4j java程序(
https://neo4j.com/developer/java/
,使用maven。
虽然我可以成功编译,但是当我运行它时,我得到一个运行时异常,表明程序找不到类,如下所示。
java com.ravi.nFourJ.App
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/neo4j/driver/v1/TransactionWork
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.neo4j.driver.v1.TransactionWork
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
这是我的pom.xml文件。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ravi.nFourJ</groupId>
<artifactId>n4-java</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>n4-java</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j.driver</groupId>
<artifactId>neo4j-java-driver</artifactId>
<version>1.4.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.neo4j/neo4j-kernel -->
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-kernel</artifactId>
<version>3.5.0-alpha03</version>
</dependency>
</dependencies>
</project>
我做了mvn编译,在project dir下创建了一个名为'target'的文件夹。
âââ target
âââ classes
â  âââ com
â  âââ ravi
â  âââ nFourJ
â  âââ App$1.class
â  âââ App.class
âââ maven-status
âââ maven-compiler-plugin
âââ compile
âââ default-compile
âââ createdFiles.lst
âââ inputFiles.lst
在我导航到“target/classes”目录并运行程序之后
java com.ravi.nFourJ.App
它给出了上述错误。
-
我在这里做错什么了吗?
-
在哪个依赖项中找到包/类“org/neo4j/driver/v1/transactionwork”?