¿Dónde está instalado Java en Mac OS X?


Acabo de descargar Java 7u17 en Mac OS 10.7.5 desde aquí y luego lo instalé con éxito. Para hacer algo de programación JNI, necesito saber dónde está instalado Java en mi Mac.

Pensé que dentro de la carpeta /Library/Java/JavaVirtualMachines/, habría una carpeta llamada 1.7.0.jdk o algo así, pero luego encontré que la carpeta está vacía. Esto se confirmó ejecutando ls /Library/Java/JavaVirtualMachines/ en la Terminal. He intentado buscarlo para averiguar si estaba instalado en otro lugar, pero eso no parece ser subiendo algo.

¿Podría alguien decirme dónde está instalado Java en mi Mac?

 586
Author: thefourtheye, 2013-04-05

14 answers

Use el comando /usr/libexec/java_home -v 1.7 en un shell de terminal para averiguar dónde está su directorio de inicio java 1.7

Si solo desea averiguar el directorio principal de su versión más reciente de java, omita la versión. por ejemplo, /usr/libexec/java_home -v

 1178
Author: gerrytan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-22 09:22:59

Resulta que en realidad tenía instalado el Java 7 JRE, no el JDK. El enlace de descarga correcto es aquí. Después de instalarlo, jdk1.7.0jdk aparece en el directorio JavaVirtualMachines.

 78
Author: Thunderforge,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-05 05:44:37

Puede usar el comando echo $(/usr/libexec/java_home) en su terminal para conocer la ruta donde se está instalando Java.

 75
Author: Pavithra Gunasekara,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-07-28 04:48:22

Si instala solo el JRE, parece que se pone en:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
 31
Author: Morrie,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-09-12 18:02:38

Use la función unix find para encontrar javas instalados...

sudo find / -name java
 22
Author: serkan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-05 05:37:51

La estructura de paquetes Java de Mac OS es un poco diferente de Windows. No se moleste por esto, ya que un desarrollador solo necesita establecer PATH y JAVA_HOME.

Así que en .bash_profile conjunto JAVA_HOME y PATH como a continuación. Este ejemplo es para Java 6:

export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
export PATH=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
 12
Author: Bimales Mandal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-06 15:01:10

Pruebe esto, Es una manera fácil de encontrar la ruta instalada de Java en Mac OS X,

GoTO

1 ) /Biblioteca es decir Macintosh HD/Biblioteca

introduzca la descripción de la imagen aquí

2) Haga clic en Biblioteca en la que encontramos la carpeta Java.

introduzca la descripción de la imagen aquí

3) Así que el camino final es

/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home

Espero que esto sea ayuda para alguien .

 10
Author: Jaywant Khedkar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-19 13:58:12

Simplemente escribe /Library/Java/JavaVirtualMachines/
en Ir a la carpeta Go > Ir en Finder

 7
Author: Mina Fawzy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-21 08:58:05

Editado: El alias de la versión actual de java es /Library/Java/Home

Para más información: un enlace

 6
Author: manny,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-05 04:06:09

Acabo de instalar el JDK para la versión 21 de Java SE 7 y encontré que está instalado en un directorio diferente del Java 6 de Apple. Está en/Library / Java... más bien en/System/Library / Java.... Ejecutar /usr/libexec/java_home-v 1.7 versus-v 1.6 confirmará esto.

 5
Author: Tony Kroch,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-04-28 12:10:11

Probé la solución de Serkan, encontró la ubicación de Java 7 en OS X Mavericks. se reside en "/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/" pero para convertirlo en el JDK predeterminado tuve que establecer la variable del sistema JAVA_HOME .bash_profile en el directorio home de "/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/" así que ahora está en funcionamiento gracias a la idea de serkan

 4
Author: Mehdi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-03-12 08:13:18

Para :

  • OS X : 10.11.6

  • Java : 8

Confirmo la respuesta de @Morrie .

   export JAVA_HOME=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home;
 3
Author: Abdennour TOUMI,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-19 00:32:41

Las Preferencias del Sistema, luego el panel de control de Java, luego la vista de Java, mostrarán la ubicación exacta del JRE predeterminado actualmente instalado.

 -1
Author: PaulNUK,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-06 10:44:47

Escriba which java en la terminal para mostrar dónde está instalado.

 -1
Author: Pranay Aryal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-05 22:12:06