I cloned the jvm-libp2p and attempt to run the Pinger example by
- Compile by
gradle clean build
- Run example by
gradle run
with build.gradle.kts having following content added
plugins {
application
...
}
application {
mainClassName = "io.libp2p.example.ping.Pinger"
}
The result shows that
$ gradle run
> Task :run FAILED
Error: Could not find or load main class io.libp2p.example.ping.Pinger
Caused by: java.lang.ClassNotFoundException: io.libp2p.example.ping.Pinger
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':run'.
> Process 'command '/home/jason/jdk-11.0.6+10/bin/java'' finished with non-zero exit value 1
Note that the source code Pinger.java is coded with package io.libp2p.example
. But neither using io.libp2p.example.ping.Pinger
nor io.libp2p.example.Pinger
in build.gradle.kts’ application section would work (regardless whether the package name in Pinger.java is package io.libp2p.example.ping
or package io.libp2p.example
.
Any suggestion? Thanks