Native library not found in Idea

I created simple gradle/java project from GradleRIO example project.


public class Robot extends IterativeRobot {

    @Override
    public void robotInit() {
        System.out.println("Hello World! Beep Boop!");
    }
}

I added a test calling robotInit() from Robot.java


@Test
    public void robotInit() {
        subject.robotInit();
    }

But, I get following error when trying to run that test.


java.lang.UnsatisfiedLinkError: no ntcore in java.library.path

	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
	at java.lang.Runtime.loadLibrary0(Runtime.java:870)
	at java.lang.System.loadLibrary(System.java:1122)
	at edu.wpi.first.networktables.NetworkTablesJNI.<clinit>(NetworkTablesJNI.java:53)
	at edu.wpi.first.networktables.NetworkTableInstance.getDefault(NetworkTableInstance.java:88)
	at edu.wpi.first.wpilibj.RobotBase.<init>(RobotBase.java:59)
	at edu.wpi.first.wpilibj.IterativeRobotBase.<init>(IterativeRobotBase.java:43)
	at edu.wpi.first.wpilibj.IterativeRobot.<init>(IterativeRobot.java:23)
	at frc.team4384.Robot.<init>(Robot.java:5)
	at frc.team4384.RobotTest.<init>(RobotTest.java:10)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Where should I add native libraries to be in the test path?

At the moment, it’s not possible to run robot code on your computer (the native libraries only exist for the specific architecture of the RoboRIO as they interface with things like the PWM ports); you’ll need to deploy the code to the robot and run it there.

To deploy your robot code, you need to execute the deploy Gradle task; you can do that by pressing Ctrl-Shift-A (Cmd-Shift-A if you’re on a Mac), searching for “Execute Gradle Task”, then typing “deploy” in the window that pops up. Alternatively, from a terminal inside your project, type ./gradlew deploy and hit Enter.