Build.gradle for NetworkTable client


I’m attempting to build a Network Tables client (in Java) to run on a desktop host, but cannot figure out how to get gradle to load the dependencies. The program is currently reduced to the trivial:

package test5;

import edu.wpi.first.networktables.NetworkTable;

import edu.wpi.first.networktables.NetworkTableInstance;

public class App {
NetworkTable nt;

public String getGreeting() {
    return "Hello World!";

public static void main(String[] args) {
    NetworkTableInstance inst = NetworkTableInstance.getDefault();
    System.out.println(new App().getGreeting());


and my build.gradle:

plugins {
// Apply the application plugin to add support for building a CLI application in Java.
id ‘application’
id “edu.wpi.first.GradleRIO” version “2022.4.1”

repositories {
// Use Maven Central for resolving dependencies.

dependencies {

// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'

// This dependency is used by the application.
implementation ''


application {
// Define the main class for the application.
mainClass = ‘test5.App’

tasks.named(‘test’) {
// Use JUnit Platform for unit tests.

The result:

  1. VS Code flags th imports as errors
  2. VS Code does not recognize the Network Table data types
  3. ./gradle build runs with out complaint (seems strange…)
  4. Attempting to run the program fails (hardly surprising) with:

Exception in thread “main” java.lang.Error: Unresolved compilation problems:
NetworkTableInstance cannot be resolved to a type
NetworkTableInstance cannot be resolved

I’m assuming that my build.gradle is not correctly resolving the dependencies. Any suggestions?

See the documentation below. You shouldn’t be using GradleRIO at all for a desktop program.

P.S. use triple-backtick (```) to quote blocks to make it easier to read in Discourse.