2

i'm trying to install apach lib on my mac os like this

sudo apt install php libapache2-mod-php

i have this error The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt. Please visit http://www.java.com for information on installing Java.

i already installed JDK and JRE

nona
  • 31
  • 3
  • Does this answer your question? [Unable to locate an executable at "/usr/bin/java/bin/java" (-1)](https://stackoverflow.com/questions/10873437/unable-to-locate-an-executable-at-usr-bin-java-bin-java-1) – Kopi Bryant Aug 24 '22 at 02:23

1 Answers1

0

I don't actually use MacOS but, try your environmental variables.

If you don't get a version back when using the command: java -version (without the quotes), the path to java probably isn't set right.

We can further check that this is the case by using the command: printenv or env to get a print out of all the variables that are pathed on your machine.

You can check to make sure your java is installed in the default location by using /usr/libexec/java_home

Then you can add to the environmental variables list by:

  1. Find the path to .bash_profile by using:

~/.bash-profile

  1. Open the .bash_profile file with a text editor of your choice.

  2. Scroll down to the end of the .bash_profile file.

  3. Use the export command to add new environment variables:

export [variable_name]=[variable_value]

The command should look something like this

export JAVA_HOME=$(/usr/libexec/java_home)

This is just a guess as I again don't use Mac or have access to one

  1. Save any changes you made to the .bash_profile file.

  2. Execute the new .bash_profile by either restarting the terminal window or using:

source ~/.bash-profile

Krazzzi
  • 1
  • 1