Networktable errrors


#1

Hello!
I am a rookie programmer. I am still confused about why it still showed these errors after I put it into the .classpath and build.gradle file.
This my code
Error

	at edu.wpi.first.wpiutil.RuntimeLoader.loadLibrary(RuntimeLoader.java:79)
	at edu.wpi.first.networktables.NetworkTablesJNI.<clinit>(NetworkTablesJNI.java:23)
	at edu.wpi.first.networktables.NetworkTableInstance.getDefault(NetworkTableInstance.java:97)
	at frc.robot.networktablesdesktopclient.run(networktablesdesktopclient.java:14)
	at frc.robot.networktablesdesktopclient.main(networktablesdesktopclient.java:11)

build.gradle

dependencies {
compile wpi.deps.wpilib()
compile wpi.deps.vendor.java()
compile group: “edu.wpi.first.ntcore”, name: “ntcore-java”, version: “4.+”
runtime group: “edu.wpi.first.ntcore”, name: “ntcore-jni”, version: “4.+”, classifier: “all”
runtime group: “edu.wpi.first.wpiutil”, name: “wpiutil-java”, version: “3.+”, classifier: “all”
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
testCompile ‘junit:junit:4.12’
}

.classpath

<?xml version=“1.0” encoding=“UTF-8”?>

<classpath>

<classpathentry kind=“src” output=“bin/main” path=“src/main/java”>

<attributes>

<attribute name=“gradle_scope” value=“main”/>

<attribute name=“gradle_used_by_scope” value=“main,test”/>

</attributes>

</classpathentry>

<classpathentry kind=“con” path=“org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/”/>

<classpathentry kind=“con” path=“org.eclipse.buildship.core.gradleclasspathcontainer”/>

<classpathentry kind=“output” path=“bin/default”/>

<classpathentry kind=“lib” path=“src/main/java/frc/libs/ntcore-java-4.0.0.jar”/>

<classpathentry kind=“lib” path=“src/main/java/frc/libs/ntcore-jni-4.0.0-all.jar”/>

<classpathentry kind=“lib” path=“src/main/java/frc/libs/wpiutil-java-3.0.0.jar”/>

</classpath>

image
Thanks!


#2

That error is because it can’t find the library file for the system you are running on. What are you trying to do and how are you trying to run it? Is this robot code? If so, you should start from one of the provided templates, not edit .classpath, and use the wpilib deploy command to run the code on the robot, which will copy the libs along with your program.


#3

Why are you adding all those extra libraries to build.gradle? The compile wpilib() line already includes it, so adding another copy is just causing major breakage, because it overwrites the version that matches wpilib. In addition, with the gradlerio setup you should not be modifying that classpath file, it’s automatically generated by vscode and things can break very badly.


#4

Here is my code.
I’m trying to follow this wpilib tutorial
package frc.robot;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;

public class networktablesdesktopclient{

public static void main(String[] args) {
    new networktablesdesktopclient().run();
}
public void run() {
    NetworkTableInstance inst = NetworkTableInstance.getDefault();
    NetworkTable table = inst.getTable("datatable");
    NetworkTableEntry xEntry = table.getEntry("x");
    NetworkTableEntry yEntry = table.getEntry("y");
    
    inst.startClientTeam(7497);  // where 
    inst.startDSClient();  // recommended if running on DS computer; this gets the robot IP from the DS

while (true) {
  try {
    Thread.sleep(1000);
  } catch (InterruptedException ex) {
    System.out.println("interrupted");
    return; 
  }

  double x = xEntry.getDouble(0.0);
  double y = yEntry.getDouble(0.0);
  System.out.println("X: " + x + " Y: " + y);
}
  }
}