We are getting an error at runtime: “java.io.IOException: wpiHaljni could not be loaded from path or an embedded resource.”
Everything I see on here says this is related to running unit tests, we are not doing anything with unit tests, absolutely nothing. We have no references to junit in any of our code.
There was one post that mentioned making sure we installed wpilibs using the installer, we’ve done that. Another mentions making sure to upgrade the project to 2020. We created the project with the 2020 libs installed so that is all set.
We have formatted the Rio to version 2020_v10 about 10 times.
It won’t let me attach it, so here it is. As a side note, I tried to run the latest WPILib installer, but it keeps putting the files in wpilib/2020 instead of frc2020. I tried to manually copy the files over and that didn’t help. Nor could I pick what directory it would install to.
plugins {
id “java”
id “edu.wpi.first.GradleRIO” version “2020.3.2”
}
def ROBOT_MAIN_CLASS = “frc.robot.Main”
// Define my targets (RoboRIO) and artifacts (deployable files)
// This is added by GradleRIO’s backing project EmbeddedTools.
deploy {
targets {
roboRIO(“roborio”) {
// Team number is loaded either from the .wpilib/wpilib_preferences.json
// or from command line. If not found an exception will be thrown.
// You can use getTeamOrDefault(team) instead of getTeamNumber if you
// want to store a team number in this file.
team = frc.getTeamNumber()
}
}
artifacts {
frcJavaArtifact(‘frcJava’) {
targets << “roborio”
// Debug can be overridden by command line, for use with VSCode
debug = frc.getDebugOrDefault(false)
}
// Built in artifact to deploy arbitrary files to the roboRIO.
fileTreeArtifact(‘frcStaticFileDeploy’) {
// The directory below is the local directory to deploy
files = fileTree(dir: ‘src/main/deploy’)
// Deploy to RoboRIO target, into /home/lvuser/deploy
targets << “roborio”
directory = ‘/home/lvuser/deploy’
}
}
}
// Set this to true to enable desktop support.
def includeDesktopSupport = false
// Maven central needed for JUnit
repositories {
mavenCentral()
}
// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.
// Also defines JUnit 4.
dependencies {
compile wpi.deps.wpilib()
compile wpi.deps.vendor.java()
nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)
nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)
testCompile ‘junit:junit:4.12’
}
// Setting up my Jar File. In this case, adding all libraries into the main jar (‘fat jar’)
// in order to make them all available at runtime. Also adding the manifest so WPILib
// knows where to look for our Robot Class.
jar {
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)
}
That fixed it. What I don’t understand is why I need to install an entirely new version of the IDE instead of just importing the extension and libraries into the IDE I already had installed. That’s what I’d done, I didn’t edit the build.grindle. It was generated when i create the project in VS 2019 with the new libs and extensions installed.