Skip to main content

Installing WPILib

This guide will walk you through installing the WPILib development environment for building and deploying robot code to the roboRIO.
Recommended: Use the official WPILib installer which includes VS Code, WPILib extensions, and all required tools in one package. Download from WPILib Releases.

Prerequisites

Before installing WPILib, ensure your system meets these requirements:
  • Windows 10 or later (64-bit)
  • At least 4GB of RAM (8GB recommended)
  • 2GB of available disk space
  • Administrator access for installation

Required Software

WPILib requires specific versions of development tools. Here’s what you’ll need:

Java Development Kit (JDK)

1

Install JDK 17

WPILib requires JDK 17. The full JDK is required (JRE is insufficient).
Download and install the JDK 17 .msi installer from Eclipse TemurinRun the installer and follow the prompts. The installer will automatically set up environment variables.
2

Verify JDK Installation

Open a terminal/command prompt and run:
java -version
javac -version
Both commands should report version 17.x.x. If not, check your PATH environment variable.
Make sure JAVA_HOME environment variable points to your JDK 17 installation directory, not the JRE.

C++ Compiler (Required for C++ Development)

1

Install C++ Build Tools

Install Visual Studio Community 2022:
  1. Download from Visual Studio Downloads
  2. Run the installer
  3. Select “Desktop development with C++” workload
  4. Complete installation (this may take 30+ minutes)
Gradle cannot use the standalone Build Tools for Visual Studio - you must install the full Visual Studio Community edition.

Building from Source

If you’re developing WPILib itself or want to use development builds:
1

Clone the Repository

Clone the WPILib repository using Git:
git clone https://github.com/wpilibsuite/allwpilib.git
cd allwpilib
The build process uses versioning information from git. Simply downloading the source zip will not work.
2

Install ARM Toolchain

Install the roboRIO cross-compilation toolchain:
./gradlew installRoboRioToolchain
This downloads and installs the ARM compiler needed to build code for the roboRIO.
If the WPILib installer was used, this toolchain is already installed.
Optional: For Raspberry Pi development:
./gradlew installArm32Toolchain
3

Build WPILib

Build all WPILib components:
./gradlew build
For faster builds with caching:
./gradlew build --build-cache
This will build:
  • HAL (Hardware Abstraction Layer)
  • WPILibJ (Java libraries)
  • WPILibC (C++ libraries)
  • ntcore (NetworkTables)
  • cscore (Camera Server)
  • wpimath (Math utilities)
  • And all other components
First build may take 20-30 minutes. Subsequent builds are much faster.
4

Publish to Local Maven

To use your local build in robot projects:
./gradlew publish
This publishes artifacts to ~/releases/maven/development.Then update your robot project’s build.gradle to use the development repository. See DevelopmentBuilds.md for details.

CMake Build (Alternative)

For Linux coprocessors or developers who prefer CMake:
1

Configure CMake

Create a build directory and configure:
cmake --preset default
This uses the default preset with Ninja generator and build-cmake directory.
2

Build Libraries

Build with multiple parallel jobs (recommended 1 job per 2GB RAM):
cmake --build build-cmake --parallel 4
wpimath requires significant RAM to compile. With less than 16GB RAM, consider building wpimath separately with fewer jobs to avoid crashes.
3

Install Libraries

Install to system directories:
sudo cmake --build build-cmake --target install
Default install location:
  • Linux: /usr/local
  • Windows: C:\Program Files (x86)\allwpilib

CMake Build Options

Customize the build with these options:
OptionDefaultDescription
BUILD_SHARED_LIBSONBuild shared libraries instead of static
WITH_JAVAOFFEnable Java and JNI builds
WITH_CSCOREONBuild camera server (requires OpenCV)
WITH_GUIONBuild GUI applications (Glass, SysId, etc.)
WITH_TESTSONBuild C++ unit tests
WITH_WPILIBONBuild HAL and WPILibC/J
Example with options:
cmake --preset default -DWITH_JAVA=ON -DWITH_TESTS=OFF

Verification

Verify your installation:
1

Check Java

java -version
javac -version
Should show JDK 17.x.x
2

Check Gradle (if building from source)

./gradlew tasks
Should list available Gradle tasks without errors
3

Test Build (Optional)

Run desktop tests to verify everything works:
./gradlew testDesktop
This builds and runs all Java and C++ tests for desktop.

Next Steps

Quick Start Guide

Create your first robot program

Official Documentation

Comprehensive guides and API reference

Troubleshooting

If you see Java version errors:
  1. Verify JDK 17 is installed: java -version
  2. Check JAVA_HOME environment variable points to JDK 17
  3. Ensure JDK (not JRE) is in your PATH before any other Java installations
Increase Gradle memory by creating/editing gradle.properties:
org.gradle.jvmargs=-Xmx4g
Or build with fewer parallel jobs:
./gradlew build -Porg.gradle.workers.max=2
Install OpenCV or disable cscore:
cmake --preset default -DWITH_CSCORE=OFF
For custom OpenCV location:
cmake --preset default -DOpenCV_DIR=/path/to/opencv/build
  1. Ensure you installed the full Visual Studio Community, not just Build Tools
  2. Verify the “Desktop development with C++” workload is installed
  3. Restart your terminal/IDE after installation

Build docs developers (and LLMs) love