pi4j-v2: Pi4J provider could not be found

Hello!

I’m trying to build a JAR artifact through IntelliJ IDEA, but everytime I try to run it in Pi I get this:

Exception in thread "main" com.pi4j.provider.exception.ProviderNotFoundException: Pi4J provider [pigpio-digital-input] could not be found.  Please include this 'provider' JAR in the classpath.
	at com.pi4j.provider.impl.DefaultRuntimeProviders.get(DefaultRuntimeProviders.java:238)
	at com.pi4j.provider.impl.DefaultProviders.get(DefaultProviders.java:147)
	at com.pi4j.provider.Providers.get(Providers.java:253)
	at com.pi4j.context.Context.create(Context.java:316)
	at com.pi4j.internal.IOCreator.create(IOCreator.java:58)
	at com.pi4j.internal.IOCreator.create(IOCreator.java:106)
	at com.pi4j.internal.IOCreator.create(IOCreator.java:186)
	at bumtzihouse.pi.gpio.GpioAccess.configureFrontButton(GpioAccess.kt:49)
	at bumtzihouse.pi.gpio.GpioAccess.init(GpioAccess.kt:18)
	at bumtzihouse.pi.Application$main$1.invokeSuspend(Application.kt:18)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at bumtzihouse.pi.Application.main(Application.kt:14)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Sorry, I can’t help you with the Kotlin side, but a fat-jar worked as described on https://pi4j.com/documentation/building/fat-jar/

Regarding Kotlin, all thanks to @mhashim6 who created the Pi4J DSL!

@FDelporte yes and thanks for the Kotlin DSL, this is amazing! I just have the same problem as the issue creator, I created a fat-tar using Shadow Gradle plugin.

That’s why I thought I need to have more than just a java -jar foo.jar. 😃