Mac os openjdk install

Install the Microsoft Build of OpenJDK

This article describes how to install the Microsoft Build of OpenJDK.

ZIP and TAR.GZ packages

For Windows, Linux, and macOS, we produce ZIP (Windows) and TAR.GZ (Linux/macOS) packages. To install, extract one of these packages in a folder of your choice, then set the JAVA_HOME environment variable to that folder.

Alternately, you can use native installers for your OS of choice, as described in the next section.

Native installers

For Windows, we produce an MSI installer with a graphical interface. For macOS, we produce a PKG installer with similar features. These installers will automatically make the JDK tools available in your PATH .

For Linux, we produce DEB and RPM packages to be used with apt and rpm .

The following sections provide instructions for these installers.

Install on Windows

To install on any version of Windows, you can use the MSI packages or the ZIP package. If you’re on Windows 10, you can use the Windows Package Manager from your Windows Terminal.

To install with the Windows Package Manager, first install winget, and then open the Windows Terminal.

Next, use the following command to search for the Microsoft Build of OpenJDK packages:

You’ll see output similar to the following:

You can now install the package by referencing the Id shown above, using the following command:

This command produces an output similar to the following:

Install on macOS

Packages for macOS are available through Homebrew or as standalone downloads in PKG or TAR.GZ formats.

To install the latest version with Homebrew:

This command produces a output similar to the following:

To install other versions with Homebrew you need to tap the cask-versions repo first:

To install on macOS with the TAR.GZ package, just extract the file into a location. The JDK will be inside /jdk- /Contents/Home .

To install using the PKG installer, open the installer and follow the instructions. By default, the JDK will be installed at /Library/Java/JavaVirtualMachines/microsoft-17.jdk/Contents/Home .

Uninstall on macOS

To uninstall the Microsoft Build of OpenJDK installed through Homebrew or PKG, use the following commands:

To uninstall the package installed through the TAR.GZ package, simply delete the folder.

Install on Ubuntu 18.04+

To install on Ubuntu 18.04 and later versions, open a terminal and run the following commands:

Читайте также:  Windows driver package amd что это

After the repository is added, install the Microsoft Build of OpenJDK by running the following commands:

Note: you may have to update your default JDK, see here for details.

Install on Debian 9

To install on Debian 9, open a terminal and run the following commands:

After the repository is added, run the following commands:

Note: you may have to update your default JDK, see here for details.

Install on Debian 10

To install on Debian 10, open a terminal and run the following commands:

After the repository is added, run the following commands:

Note: you may have to update your default JDK, see here for details.

Install on CentOS 7 (RPM)

To install on CentOS 7, open a terminal and run the following command:

After the repository is added, run the following command:

Note: you may have to update your default JDK, see here for details.

Set Microsoft Build of OpenJDK as the default on Linux

If you have several versions of OpenJDK installed on your system, use the following command to set the Microsoft Build of OpenJDK as the default:

For CentOS, you can use the command alternative .

Provide feedback on the Microsoft Build of OpenJDK

Send us your comments, thoughts, and ideas to help us improve the Microsoft Build of OpenJDK. Visit our OpenJDK discussions page on GitHub to send us your feedback.

Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Источник

How to download and install prebuilt OpenJDK packages

JDK 9 & Later

Oracle’s OpenJDK JDK binaries for Windows, macOS, and Linux are available on release-specific pages of jdk.java.net as .tar.gz or .zip archives.

As an example, the archives for JDK 13 may be found on jdk.java.net/13 and may be extracted on the command line using

depending on the archive type.

JDK 8

Debian, Ubuntu, etc.

On the command line, type:

The openjdk-8-jre package contains just the Java Runtime Environment. If you want to develop Java programs then please install the openjdk-8-jdk package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.

JDK 7

Debian, Ubuntu, etc.

On the command line, type:

The openjdk-7-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-7-jdk package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

The java-1.7.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.7.0-openjdk-devel package.

JDK 6

Debian, Ubuntu, etc.

On the command line, type:

The openjdk-6-jre package contains just the Java Runtime Environment. If you want to develop Java programs then install the openjdk-6-jdk package.

Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

On the command line, type:

The java-1.6.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.6.0-openjdk-devel package.

Читайте также:  The most secure linux

BSD Port

For a list of pointers to packages of the BSD Port for DragonFly BSD, FreeBSD, Mac OS X, NetBSD and OpenBSD, please see the BSD porting Project’s wiki page.

Источник

drm317 / gist:3e2a9ce4ba1288c4fbaab1e534d71133

OpenJDK 11+ on MacOS X

Manually downloading, extracting and configuring the installation of OpenJDK 11+ is a high-maintenance exercise. Particularly if you need to install and switch between multiple versions of the JDK.

The following options for installing OpenJDK 11+ and switching between versions make the job easier..

Install with Jabba

Jabba is a Java version manager inspired by nvm (Node.js) written in Go.

  1. Install Jabba if you don’t have it already
  1. The list of available JDK can be displayed
  1. OpenJDK 11 can be installed with
  1. Switch to a specific version with

Jabba automatically manages JAVA_HOME and PATH settings. It installs JDKs to

Install with SDKMAN

SDKMAN is a tool for running multiple development kits on a machine. It can manage the installation and switching of Java versions.

  1. Install SDKMAN if you don’t have it already

Follow the instructions on-screen.

Next, run the following

  1. The different available versions of Java can be listed
  1. Install the OpenJDK 11 with
  1. Make OpenJDK 11 the default version

or switch to a different version for a particular session

Install with Homebrew

Before 3rd October 2018 the Oracle Java JDK was available via Homebrew. It has now been updated to OpenJDK.

  1. Install Homebrew if you don’t have it already. Ensure it is updated
  1. Add the casks tap
  1. Search for installable versions
  1. Verify the details of the version that will be installed
  1. Install a specific version java8 , java10 or the latest java

The AdoptOpenJDK is also available from Homebrew Cask

The installation directory is /Library/Java/JavaVirtualMachines/ which is the traditional location on MacOSX

To find the locations of installed JDKs

or for a specific version

Note the upper and lowercase ‘v’.

The /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home utility can be to change versions manually or add aliases for a particular shell. The following can be added to .bash_profile or .profile

The aliases can be used to change versions on the fly

Источник

How to install Java JDK on macOS

By mkyong | Last updated: January 19, 2021

Viewed: 220,923 (+5,913 pv/w)

This article shows how to install Java JDK on macOS, Homebrew package manager, manual installation, and switch between different JDK versions.

  • macOS 11 Big Sur
  • Homebrew 2.7.4
  • JDK 8, 14, 16, 16 (AdoptOpenJDK and OpenJDK)

P.S At the time of writing, the latest JDK GA is JDK 15, and the early access build is JDK 16.

Note
Since macOS 10.15 Catalina, the default Terminal shell switch from the bash (Bourne-again shell) to zsh (Z shell). And we should move all the startup scripts and environment variables in

1. Homebrew install latest Java on macOS

1.1 Install and upgrade Homebrew.

1.2 brew search java to find all available Java-related formula.

1.3 brew info to show the formula details.

The java formula is always containing the latest Java JDK (OpenJDK) GA version; at the time of writing, the latest GA is JDK 15.

Читайте также:  Можно ли одну лицензию windows

The java11 formula is containing the Java 11 LTS version.

1.4 brew install java to install the latest JDK 15.

1.5 Where does Homebrew install the java?
Homebrew installed the JDK files and directories at /usr/local/Cellar/openjdk/ , and symbolic link at /usr/local/opt/openjdk points to the latest Java 15.0.1 version.

1.6 The java formula is keg-only, which means it is installed in /usr/local/Cellar but not linked into places like /usr/local/bin or /Library/Java/JavaVirtualMachines/ (macOS /usr/bin/java wrapper).

For macOS /usr/bin/java wrapper to find the installed JDK, we manually create a symbolic link at /Library/Java/JavaVirtualMachines/ .

Источник

Solarian Programmer

My programming ramblings

Installing Java OpenJDK on macOS Catalina

Posted on September 28, 2018 by Paul

Updated 15 October 2019

This is a short note about getting started with Java 11 LTS or Java 13 on macOS Catalina. As you probably know, starting with Java 11 there was a big change in the license under which the official Oracle JDK is provided. In short, you need to buy a license from Oracle if you want to use the official JDK in a commercial setting. As far as I know, using Oracle’s JDK on your private computer for testing and learning purposes is allowed.

That being said, for most users OpenJDK is the new JDK of choice, it is provided under an open source license and you don’t need to pay for using it.

There is also a video version of this tutorial:

At this time, Java 11, the long term release or LTS, of Java is no longer supported on the OpenJDK website. You can still get the archived version, but this is not recommended because it doesn’t include any new security patches. If you still need to use Java 11, use an alternative build like the one from AdoptOpenJDK. From the AdoptOpenJDK page you will download a pkg file that you can install on your macOS machine directly by double clicking on it.

After you’ve installed the AdoptOpenJDK pkg file, check if you can use it with:

This is what I see on my machine:

If you prefer to use the Java version provided by the OpenJDK website, you will need to use Java 13. Start by getting OpenJDK, chose the macOS version. Extract the archive by double clicking on the file or, assuming it is in your Downloads folder, write this in your Terminal:

Next step, is to move the extracted folder to a place where macOS searches for Java JDK:

Now, check if you’ve successfully installed the JDK with:

This is what I see on my machine:

Just to be sure that everything works, try to compile and run a simple program:

Save the above as HelloWorld.java and compile it with:

If you want to run the compiled version:

This is what I see on my machine:

Side note, you can also run directly the program, without the separate compilation step with:

but this is usually slower than compiling the code with javac and running the compiled code.

Источник

Оцените статью