For the complete documentation index, see llms.txt. This page is also available as Markdown.

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
.  endif

OpenJDK

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 Java

This 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:

Eclipse

Set the default workspace:

Eclipse

Chinese Language Environment

Click the Help menu, then select Install New Software.

Eclipse menu

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

Eclipse menu

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:

Eclipse menu

Loading:

Eclipse menu

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

Eclipse menu

Click Next.

Eclipse menu

Accept the agreement:

Eclipse license agreement

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

Eclipse setting up Chinese language environment

Restart to apply changes:

Eclipse home page
Eclipse Chinese home page

A Blessing for a Beautiful World

Click "Create Java project", with the project name test.

Create Java project

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

Create Java class

Write the following code in the class file:

Click the run button to view the output.

Eclipse HelloWorld output

References

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:

IntelliJ IDEA launch screen

Set language and region:

IntelliJ IDEA language and region

Accept the user agreement:

IntelliJ IDEA user agreement

Choose whether to send anonymous usage statistics as needed:

IntelliJ IDEA data sharing

IntelliJ IDEA main interface:

IntelliJ IDEA data sharing

A Blessing for a Beautiful World

Click "New Project", enter "HelloWorld" in the "Name" field:

IntelliJ IDEA new project

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

IntelliJ IDEA new project

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

About IntelliJ IDEA

Last updated