Go / Rust / Java
26.10 Version Differences
The 26.10 release notes list Go 1.27, Rust 1.97.1 and OpenJDK 25.0.4, with OpenJDK 27 also available. Repository and independently installed toolchains may differ. Check go version, rustc --version and java -version against your project requirements. Official release notes
This article covers how to set up Go, Rust, and Java development environments on Ubuntu 26.04.
Go Language
Install Go
Download the latest version from the official site:
# Check the current stable release at https://go.dev/dl/ first (e.g. go1.26.4),
# then replace GO_VERSION below with the actual version number
GO_VERSION=1.26.4
wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
# Remove old version and extract
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
# Clean up the downloaded file
rm go${GO_VERSION}.linux-amd64.tar.gzConfigure environment variables by adding the following to ~/.bashrc or ~/.zshrc:
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/binApply the configuration and verify:
source ~/.bashrc
go versionConfigure Go Module Proxy
In mainland China, configuring a proxy is recommended to speed up module downloads:
go env -w GOPROXY=https://goproxy.cn,directGo Project Basics
# Initialize a module
mkdir myproject && cd myproject
go mod init github.com/username/myproject
# Add a dependency
go get github.com/gin-gonic/gin
# Run the program
go run main.go
# Build
go build -o myapp
# Run tests
go test ./...
# Format code
go fmt ./...
# Install tools
go install golang.org/x/tools/gopls@latestCommon Development Tools
# Language server (IDE support)
go install golang.org/x/tools/gopls@latest
# Linter
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
# Hot reload
go install github.com/air-verse/air@latestRust Language
Install via rustup
rustup is the official Rust installer and version manager:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shDuring installation, select the default option (option 1). After installation, load the environment:
source "$HOME/.cargo/env"Verify the installation:
rustc --version
cargo --versionConfigure China Mirror
Edit ~/.cargo/config.toml:
[source.crates-io]
replace-with = 'ustc'
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"Or use the ByteDance mirror:
[source.crates-io]
replace-with = 'rsproxy'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = trueRust Basics
# Create a new project
cargo new myproject
cd myproject
# Build and run
cargo run
# Build only
cargo build
# Build release version (optimized)
cargo build --release
# Run tests
cargo test
# Check code (no binary output, faster)
cargo check
# Format code
cargo fmt
# Lint
cargo clippy
# Add dependencies
cargo add serde tokioManage Rust Toolchains
# Update Rust
rustup update
# Install nightly version
rustup toolchain install nightly
# Switch toolchains
rustup default nightly
rustup default stable
# Set toolchain for a project
rustup override set nightly
# Install components
rustup component add rust-analyzer
rustup component add rust-srcJava (OpenJDK)
Install OpenJDK
Ubuntu 26.04’s repository provides multiple OpenJDK versions:
# Install the default OpenJDK 25
sudo apt install default-jdk -y
# Or explicitly install OpenJDK 25
sudo apt install openjdk-25-jdk -y
# If you only need to run Java programs
sudo apt install default-jre -yVerify the installation:
java --version
javac --versionManage Multiple Java Versions
# List installed Java versions
sudo update-alternatives --list java
# Switch the default Java version
sudo update-alternatives --config java
sudo update-alternatives --config javacConfigure JAVA_HOME
Add to ~/.bashrc:
export JAVA_HOME=/usr/lib/jvm/java-25-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATHsource ~/.bashrc
echo $JAVA_HOMEInstall Maven
Maven is the most widely used build tool for Java projects:
sudo apt install maven -y
mvn --versionBasic usage:
# Create a project
mvn archetype:generate -DgroupId=com.example -DartifactId=myapp -DarchetypeArtifactId=maven-archetype-quickstart
# Compile
mvn compile
# Package
mvn package
# Run tests
mvn test
# Clean build artifacts
mvn cleanConfigure a China mirror by editing ~/.m2/settings.xml:
<settings>
<mirrors>
<mirror>
<id>aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Aliyun Maven Mirror</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
</mirrors>
</settings>Install Gradle
# Install via SDKMAN (recommended)
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install gradle
# Verify
gradle --versionManage JDKs with SDKMAN
SDKMAN makes it easy to manage multiple JDK distributions:
# List available JDKs
sdk list java
# Install a specific version
sdk install java 21.0.5-tem
# Switch versions
sdk use java 21.0.5-tem
sdk default java 21.0.5-temEach of these three languages has its strengths: Go is great for network services and cloud-native development, Rust excels at systems programming and high-performance scenarios, and Java is ideal for enterprise application development. Choose the right language based on your project requirements.