1

On the FreeBSD Ports Search page, I see results listing an item openjdk11-11.0.4+11.1.

When I try to install that:

$ sudo pkg install openjdk11-11.0.4+11.1 

…I get error saying the package could not be found:

Updating FreeBSD repository catalogue...

FreeBSD repository is up to date.

All repositories are up to date.

pkg: No packages available to install matching 'openjdk11-11.0.4+11.1' have been found in the repositories

➥ What am I missing here? What is the proper way to install Java/OpenJDK 11 or 12 on FreeBSD 12?

1 Answer 1

2

tl;dr

Use the short general name of the project openjdk11, not the long specific package name openjdk11-11.0.4+11.1.

$ sudo pkg install openjdk11 

Use short name of project

Click that link you posted, the listing for item openjdk11-11.0.4+11.1.

screenshot of the detail page for the <code>openjdk11</code> package in the FreeBSD Ports & Packages site.

On the next displayed page, note the header:

Index of /head/java/openjdk11

Take that last part as the name of the package to be installed. So here, we want just openjdk11.

Install using that short name.

$ sudo pkg install openjdk11 

…and the prompt appears asking to go forward with installation. You will automatically get the latest update to that version of Java. Notice in the listing that web page seen above how both 11.0.3 and an update to 11.0.4 are mentioned.

Binary package

For a pre-built install of Java simply run:

sudo pkg install openjdk12 

You will then find your OpenJDK installed at /usr/local/openjdk12/.

You may then want to set some environment variables to lead to your installation. For example, in my .zshrc file to configure zsh I add:

 path+=/usr/local/openjdk12/bin 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.