Install Java on OpenBSD

Contents
Introduction
Install a JDK
JAVA_HOME
Check the version
Which JDK flavor

Introduction

OpenBSD packages OpenJDK for the current release. The package name carries the major version, so installing a specific release is explicit.

Install a JDK

doas pkg_add jdk-17

Without doas configured, run the same command as root. The JDK lands under /usr/local/jdk-17.

JAVA_HOME

Point build tools at the JDK:

export JAVA_HOME=/usr/local/jdk-17

Add the line to ~/.profile to keep it across logins.

Check the version

java -version

Both java and javac must report the installed release.

Which JDK flavor

OpenBSD packages the standard OpenJDK; there is no Oracle binary to compare with, which simplifies the choice to the major version your project targets. Match production exactly — «works on my Linux, fails on OpenBSD» almost always means different JDK builds, not different code.

Related articles
Development на Java
Установка Java
Install Java on Linux
Install Java on FreeBSD
Install Java on macOS
Install Java on OpenBSD
Intellij
Компиляция и запуск Java кода
final
switch
Определить тип переменной
Генератор случайных чисел
Импорт из других классов
Maven
JUnit

Search this site

Subscribe to Telegram channel @aofeed to follow new articles and updates to old ones

Go to channel

@aofeed

Ask a question in the Telegram group

@aofeedchat

Contacts and cooperation:
I recommend our hosting beget.ru
Write to info@urn.su, info@aredel.com if you:
1. Want to write an article for our site or translate an article into your native language.
2. Want to place thematically relevant ads on the site.
3. Ads on my site pass maximum censorship. If you see an ad block unsuitable for school-age children, shocking or misleading - please contact us by e-mail
4. Found a mistake, inaccuracy, bug, etc. on the site. ... .......
5. Articles can be shared on social media by clicking a network icon: