Skip to content

Instantly share code, notes, and snippets.

@mepcotterell
Last active February 7, 2022 08:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mepcotterell/e00a37ccf54d9b8ae1a390bb1e5d4336 to your computer and use it in GitHub Desktop.
Save mepcotterell/e00a37ccf54d9b8ae1a390bb1e5d4336 to your computer and use it in GitHub Desktop.

Setup Oracle JDK 8 on MacOS

  1. Download the .dmg file for "macOS x64" here. Due to licensing, you will need to login to start the download. Creating an account is free.

  2. Install the JDK on your system by double clicking the .dmg file, then running the installer.

  3. Once installed, launch Terminal and execute the following command on your Mac to execute a script that installs mvn, if needed, and a program called jenv that will let you switch between different JDK installations if you have more than one:

    $ curl -s -L http://csweb.cs.uga.edu/~mec/cs1302macOS-2020-04-13.sh | bash
    

    There may be a lot of output. Pay careful attention to the end, which should be similar (but maybe not identical) to the following:

    The latest installed Oracle JDK is oracle64-1.8.0.241.
    You can use the following command in a NEW terminal window
    to activate it:
     jenv local oracle64-1.8.0.241
    
  4. Launch a new Terminal window, execute the jenv command provided in your output, then inspect the output of the following command to see if everything worked:

    $ mvn -v | sed -n 3p
    

    It should be similar to the following:

    Java version: 1.8.0_241, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre
    
  5. If you need to change which JDK version you're using, then inspect the versions using jenv versions, then activate the one you want using jenv local jdk_name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment