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
- macOS
- Linux
- 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)
Install JDK 17
WPILib requires JDK 17. The full JDK is required (JRE is insufficient).
- Windows
- macOS
- Linux (Ubuntu)
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.
C++ Compiler (Required for C++ Development)
Install C++ Build Tools
- Windows
- macOS
- Linux
Install Visual Studio Community 2022:
- Download from Visual Studio Downloads
- Run the installer
- Select “Desktop development with C++” workload
- Complete installation (this may take 30+ minutes)
Building from Source
If you’re developing WPILib itself or want to use development builds:Install ARM Toolchain
Install the roboRIO cross-compilation toolchain:This downloads and installs the ARM compiler needed to build code for the roboRIO.Optional: For Raspberry Pi development:
If the WPILib installer was used, this toolchain is already installed.
Build WPILib
Build all WPILib components:For faster builds with caching: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.
Publish to Local Maven
To use your local build in robot projects: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:Configure CMake
Create a build directory and configure:This uses the default preset with Ninja generator and
build-cmake directory.CMake Build Options
Customize the build with these options:| Option | Default | Description |
|---|---|---|
BUILD_SHARED_LIBS | ON | Build shared libraries instead of static |
WITH_JAVA | OFF | Enable Java and JNI builds |
WITH_CSCORE | ON | Build camera server (requires OpenCV) |
WITH_GUI | ON | Build GUI applications (Glass, SysId, etc.) |
WITH_TESTS | ON | Build C++ unit tests |
WITH_WPILIB | ON | Build HAL and WPILibC/J |
Verification
Verify your installation:Next Steps
Quick Start Guide
Create your first robot program
Official Documentation
Comprehensive guides and API reference
Troubleshooting
Java version mismatch
Java version mismatch
If you see Java version errors:
- Verify JDK 17 is installed:
java -version - Check
JAVA_HOMEenvironment variable points to JDK 17 - Ensure JDK (not JRE) is in your PATH before any other Java installations
Gradle build fails with OutOfMemoryError
Gradle build fails with OutOfMemoryError
Increase Gradle memory by creating/editing Or build with fewer parallel jobs:
gradle.properties:CMake can't find OpenCV
CMake can't find OpenCV
Install OpenCV or disable cscore:For custom OpenCV location:
Visual Studio 2022 not detected on Windows
Visual Studio 2022 not detected on Windows
- Ensure you installed the full Visual Studio Community, not just Build Tools
- Verify the “Desktop development with C++” workload is installed
- Restart your terminal/IDE after installation