21.2 Java Development Environment
FreeBSD Ports controls the default JDK version through JAVA_DEFAULT in Mk/bsd.default-versions.mk. The current default for AMD64 architecture is OpenJDK 25 (LTS).
The support plan for each Java version can be found at Oracle Java SE Support Roadmap.
JDK
See: FreeBSD Project. java[EB/OL]. [2026-03-26]. https://www.freebsd.org/java/. This is the official FreeBSD Java development environment configuration guide. The default Java version in FreeBSD Ports is controlled by the JAVA_DEFAULT variable in the Ports Mk/bsd.default-versions.mk file. The current default for AMD64 architecture is OpenJDK 25:
# Possible values: 8, 11, 17, 21, 23, 24, 25
. if ${ARCH:Marmv*} || ${ARCH} == powerpc # ARMv series and PowerPC architectures use Java 11
JAVA_DEFAULT?= 11
. elif ${ARCH:Mi386}
JAVA_DEFAULT?= 21 # i386 architecture uses Java 21
. else
JAVA_DEFAULT?= 25 # Other architectures use Java 25
. endifOpenJDK
Search for packages with "jdk" in their name or description:
# pkg search -o jdk
ykla@ykla:~ $ pkg search -o jdk
java/bootstrap-openjdk11 Java Development Kit 11
java/bootstrap-openjdk17 Java Development Kit 17
java/bootstrap-openjdk8 Java Development Kit 8
java/openjdk11 Java Development Kit 11
java/openjdk11-jre Java Runtime Environment 11
java/openjdk17 Java Development Kit 17
java/openjdk17-jre Java Runtime Environment 17
java/openjdk21 Java Development Kit 21
java/openjdk21-jre Java Runtime Environment 21
java/openjdk24 Java Development Kit 24
java/openjdk25 Java Development Kit 25
java/openjdk25 Java Development Kit (headless version) 25
java/openjdk25 Java Runtime Environment 25
java/openjdk25 Java Runtime Environment (headless version) 25
java/openjdk26 Java Development Kit 26
java/openjdk26 Java Development Kit (headless version) 26
java/openjdk26 Java Runtime Environment 26
java/openjdk26 Java Runtime Environment (headless version) 26
java/openjdk8 Java Development Kit 8
java/openjdk8-jre Java Runtime Environment 8
comms/rxtx Native interface to serial ports in JavaThis section uses java/openjdk25 as an example.
Installing OpenJDK 25
Install OpenJDK 25 using pkg:
Or install using Ports:
Display the version information of the installed Java:
After installation, the $JAVA_HOME environment variable has not been configured yet. Use the following command to check its current value:
Check the OpenJDK 25 installation path:
Related file structure:
Configuring Environment Variables
Shell Configuration Files
Please select the appropriate path based on your shell.
Write the following content to the corresponding shell configuration file path:
Reloading Shell Environment Variables
Reload the ~/.shrc configuration file (note the leading dot . which means source):
Display the current JAVA_HOME environment variable value:
Display the current PATH environment variable value (including JAVA_HOME/bin):
Eclipse
Eclipse is an open and extensible integrated development environment (IDE) suitable for various development scenarios. It provides the foundational modules and platform for building and running integrated software development tools, supporting tool developers to work independently and integrate with other tools.
Installing Eclipse
Install using pkg:
Or install using Ports:
Launching Eclipse
Click the "Eclipse" entry in the menu to launch Eclipse:

Set the default workspace:

Chinese Language Environment
Click the Help menu, then select Install New Software.

Uncheck Contact all update sites during install to find required software:

Then click Add: clear the existing content in Location and enter https://mirrors.tuna.tsinghua.edu.cn/eclipse/technology/babel/update-site/latest/. Then click Add:

Loading:

Check Babel Language Packs in Chinese (Simplified). Click Next.

Click Next.

Accept the agreement:

It is recommended to click anywhere at the bottom of the interface first, then select all, otherwise the interface may become unresponsive.

Restart to apply changes:


A Blessing for a Beautiful World
Click "Create Java project", with the project name test.

Right-click to create a new package, then create a new Java class named TEST.

Write the following code in the class file:
Click the run button to view the output.

References
xxhxs-21. Eclipse usage and configuration comprehensive guide[EB/OL]. [2026-03-26]. https://www.cnblogs.com/xxhxs-21/articles/16417603.html. Introduces common configurations and development tips for the Eclipse IDE.
ittel. Eclipse 2024.03 installation tutorial (with Chinese language setup guide)[EB/OL]. [2026-03-26]. https://www.ittel.cn/archives/35394.html. Provides detailed steps for Eclipse IDE installation and Chinese localization.
IntelliJ IDEA
Starting from 2025.3, IntelliJ IDEA no longer distinguishes between Community Edition and Ultimate Edition, merging into a unified product. The intellij-ultimate in FreeBSD Ports is currently version 2025.3, synchronized with upstream.
Installing IntelliJ IDEA
Install using pkg:
Or install using Ports:
Launching IntelliJ IDEA
Click the "IntelliJ IDEA Ultimate Edition" entry in the menu to launch IntelliJ IDEA:

Set language and region:

Accept the user agreement:

Choose whether to send anonymous usage statistics as needed:

IntelliJ IDEA main interface:

A Blessing for a Beautiful World
Click "New Project", enter "HelloWorld" in the "Name" field:

The IDE will automatically fill in some code. Click the run button in the top toolbar to run:

You can change the theme in "Settings" → "Theme...":

Last updated