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

Adding Java home not working on windows ZSH

I have java installed and set up properly and works fine with the normal Windows Powershell. However, I’m trying to make java work with the ZSH terminal and I cannot get it to work.

My JAVA_HOME (in powershell) is set to this path:

C:\Program Files\Java\jdk-15.0.2

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

Im trying to add this line to my .zshrc file:

export JAVA_HOME=`/mnt/c/"Program Files"/Java/jdk-15.0.2`

but when i do source .zshrc it says permission denied to that file. Running sudo chmod doesnt seem to help either. Am i doing something wrong or missing some other line to add? Most tutorials for ZSH is on a Mac OS so i dont know if it differs being that im in windows…

>Solution :

The backticks are trying to "execute" that folder as a shell command.

Double quotes will store that variables as a string

export JAVA_HOME="/mnt/c/Program Files/Java/jdk-15.0.2"

But this doesn’t guarantee that java command itself will work.

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