Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

jvm path not found on mac

I have installed java11 using

brew install java11

Then I tried the below to get JAVA_HOME

echo $JAVA_HOME

It returned empty .
so following the instructions in echo $JAVA_HOME returns nothing

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

when I have run ls -l /usr/bin/java
i cannot see any jvm path as shown in the above link. Below is what I got

 ~ % ls -l /usr/bin/java
-rwxr-xr-x  1 root  wheel  168432 Dec  8 05:09 /usr/bin/java

ls -l /usr/lib/jvm/
ls: /usr/lib/jvm/: No such file or directory

How to set JAVA_HOME

>Solution :

If you’re using bash, all you have to do is:

echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.bash_profile

If you’re using zsh (which probably means you’re running macOS Catalina or newer), then it should instead be:

echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.zshrc

In either case, restart your shell.

If you have multiple JDK versions installed and you want it to be a specific one, you can use the -v flag to java_home like so:

echo export "JAVA_HOME=\$(/usr/libexec/java_home -v 1.7)" >> ~/.bash_profile
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading