If you purchased a new Mac device (Macbook, iMac, Mac mini) and trying to run java or javac command in Terminal you will get the below error as there is no Java Runtime pre-installed.
code2care@mac ~ % java
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
code2care@mac ~ % javac
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
![Unable to locate Java Runtime macOS Error Unable to locate Java Runtime macOS Error](https://code2care.org/howto/this-operation-couldnt-be-completed-unable-to-locate-a-java-runtime-maos/images/Unable to locate Java Runtime macOS Error.png)
Unable to locate Java Runtime macOS Error
You need to visit http://www.java.com and download java dmg setup and install.
Note: Native M1 Oracle Java is not yet available for MacBooks/Mac Mini's that are running on Apple Silicon M1 Chips, this setup will work using Rosetta 2 - which will convert the code for you!
Intel-based Mac running Mac OS X 10.7.3 (Lion) or later.
Update: You can install Open JDK that natively supports M1 Mac's : https://code2care.org/q/install-native-java-jdk-jre-on-apple-silicon-m1-mac
More Posts related to MacOS,
- Fix: grunt: command not found (Mac/Windows)
- AppleScript Example with TextEdit
- How to copy Password of Wifi on your Mac
- Install OpenJDK Java (8/11/17) versions using brew on Mac (Intel/M1/M2)
- How to check if a port is in use using terminal [Linux or macOS]
- Cut, Copy and Paste Keyboard Shortcuts on Mac Keyboard
- [macOS] NetBeans IDE cannot be installed. Java (JRE) found on your computer but JDK XX or newer is required.
- How to Remove Widgets from macOS Sonoma 14 Desktop
- Turn off Auto-Capitalization on macOS Ventura 13
- How to Go To /usr/local/bin on Mac Terminal?
- How to Open TextEdit on Mac
- Mac: How to Open Android Studio from Terminal
- How to change the default location of Mac Screenshot
- Display Seconds in Digital Clock on Mac Menu Bar [macOS]
- How to install homebrew (brew) on M1 Mac
- Must Know Homebrew Commands for Mac/Linux Users
- Steps to Uninstall Roblox on Mac (macOS)
- How to change the System Settings Sidebar icon size Mac Ventura 13
- How to set Out Of Office (OOO) on Outlook for Mac [Updated 2023]
- Trigger Notification Center Message using Mac Terminal Command
- [fix] macOS Ventura - Python3 xcrun: error: invalid active developer path missing xcrun at CommandLineTools
- How to Install Rust Language on Mac (macOS)
- How to minimize all Windows in Mac
- Display ls command file sizes in KB (kilobytes) MB (megabytes) or GB (gigabytes) [Linux/macOS]
- How to make TextEdit the default text Editor on Mac
More Posts:
- How to Change Encoding of File from ANSI to UTF-8 in Windows Notepad - Windows
- How to zoom-in or zoom-out in Windows Notepad - NotepadPlusPlus
- How to install Python 3.9 using brew on Mac - Python
- Fix: error: non-static type variable T cannot be referenced from a static context - Java
- How to get Spotify macOS App installed on Mac device - MacOS
- List of Programming Languages Supported by Notepad++ - NotepadPlusPlus
- How to Open and Use Microsoft Edge Console - Microsoft
- Java 8: Stream map with Code Examples - Java