When I run JUnit I recieve an error message.

My team is trying out JUnit for the first time, but when we try to run it we get an error message saying
java.lang.UnsatisfiedLinkError: no ntcore in java.library.path

We are using the default SampleRobot with the methods below added for testing.


@Test
public void testAdd() {
	assertEquals(2, add(1, 1));
}

public int add(int a, int b) {
	return a + b;
}

I had a similar problem with OpenCV when I first started. What solved the problem was adding the path to the .dll file path in VM arguments(Doesn’t look like JUnit has any .dll files) and using a system load library as the first thing in the constructor/main of my program.


//Example 
System.loadLibrary("opencv_java310"); //opencv_java310 is the name of the .jar file

Correct. In this case, there’s a System.loadLibrary() call in NetworkTablesJNI that’s not able to find ntcore.dll / ntcore.so (Windows / Linux). This is probably because you are using the networktables arm JAR instead of the desktop JAR, which contains the binaries for desktop platforms. You can download the desktop JAR here: http://first.wpi.edu/FRC/roborio/maven/release/edu/wpi/first/wpilib/networktables/java/NetworkTables/3.1.7/NetworkTables-3.1.7-desktop.jar