Skip to content

viviRbi/java-mac-install-guide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Mac Java Environment Setup Guide

Install Using A Package Manager

A package manager is a command line tool that allows you to install and manage software. You can use a package manager to install all of the software listed here.

The package manager that we'll be using for this guide is called Homebrew. It's a command-line installer for MacOS, which means that you'll have to be running a macOS in order to use. The examples provided here are utilizing macvscodeOS Catalina version 10.15.5.


Step 1: Install Homebrew

Open your terminal and run /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then run brew.

The result should look like the following:

Step 2: Install Git

With Homebrew installed, you are now ready to install Git. Open a terminal window and enter brew install git

To verify that Git is installed on your system, type git --version


Step 3: Install JDK 8

In your terminal run: brew install adoptopenjdk/openjdk/adoptopenjdk8

Configure your Environment Variables

A. Mac OSX 10.5 or later:

In Mac OSX 10.5 or later, Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home, just export $JAVA_HOME in file ~/. bash_profile or ~/.profile.

# This will open up a text editor called vim
$ vim .bash_profile

# Inside the text editor, write this
export JAVA_HOME=$(/usr/libexec/java_home)

# To quit vim and save your changes:
# 1. press the ESC key
# 2. You should see the ––INSERT–– label vanish from the lower-left.
# 3. To save your changes before you exit, type :w , and then Enter. This will save any changes made. 
#       Vim will respond by outputting the filename, whether it’s new, and how many characters were written to the hard drive.

# Next, execute the file you created
$ source .bash_profile

# Confirm that the path variable has been set
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home

B. Older Mac OSX:

For older Mac OSX, the /usr/libexec/java_home doesn’t exist, so, you should set JAVA_HOME to the fixed path:

$ vim .bash_profile

export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home

$ source .bash_profile

$ echo $JAVA_HOME
/System/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home

Step 4: Install Spring Tool Suite 4

Navigate to https://spring.io/tools and download the appropriate version of Spring Tool.

If your installation was successful, you should now be able to search for Spring Tool Suite in your spotlight search using cmd+space.

Once downloaded, open Spring Tool and navigate to your preferences.

  1. Select Java in the left panel of your preferences and click on Installed JREs.

  1. Click add on the right side of your preferences menu and select Standard VM.

  1. Click the Directory button to navigate to your installed Java versions.

    • When the finder window opens select your HD.
    • Select Library and look for Java listed below.
    • Click on Java and navigate into JavaVirtualMachines where you should see an adoptopenjdk-8.jdk.
    • Select this JDK and navigate to Contents and then Home.
    • With home highlighted, click Open.

You should now see this:


Step 5: Install Maven

To install Maven with Homebrew, open your terminal window and run: brew install maven

Once the download is complete, verify the installation by running: mvn -v


Step 6: Install DBeaver

Navigate to https://dbeaver.io/download/ and download the appropriate version of DBeaver.

If your installation was successful, you should now be able to search for "dbeaver" in your spotlight with cmd + space.


Step 7: Install Apache Tomcat 8

Follow these instructions. The author has downloaded Apache Tomcat 9. You will download Apache Tomcat 8 and follow the exact same steps and terminal commands.


Step 8: Install Postman

The following is the single command required to install Postman on macOS using Homebrew:

brew cask install postman

Step 9: Install PostgreSQL 13

We will manually download the PostgreSQL installer visiting the official website. Look at the row for version 13.x.

Select the download link which corresponds with your system and click it.

You'll then be prompted to save the file. Click Save File. The file should now be located in your Downloads folder.

Double click the file, which should launch the installer. You might be asked if you want the application to make changes to your device. Click yes.

You'll be presented with several menus in the Setup Wizard. Click Next until you get to the Select Components menu.

Here, you'll want to select and/or deselect the following and then click Next:

Continue to click Next until you reach the Password menu. Here you will create a password for the default Postgres user (which is postgres). DO NOT use a password you use anywhere else. I reccomend making the password postgres. DO NOT forget your password as you won't be able to login to your database as the superuser.

After you've decided on a password, click Next on the remaining menus and allow time for Postgres to be installed.

Once the installation is complete, you might be asked if you want to launch Stack Builder. You can say no.

PostgreSQL should now be successfully installed on your computer.


Step 10: Install Docker

Docker is an open source containerization platform. It enables developers to package applications into containers—standardized executable components combining application source code with the operating system (OS) libraries and dependencies required to run that code in any environment.

Go here to download Docker Desktop 👈


Additional Resources

About

A basic install guide for Mac users in the Full Stack Java/Microservices batch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published