I get the following error when I try to run JSLint from SublimeText 2 on my Mac:
/bin/sh: java: command not found
I think it is to do with Java not being in the PATH
on Mac, can anyone help with this please?
From this article and a couple of others, it looks like you edit your ~/.profile
file (the .profile
in your home directory), find the line that starts with export PATH=...
, and add the Java bin
directory at the beginning or end, separating it from the previous/next element with a colon (:
).
E.g., if it looks like this:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
change it to
export PATH=/opt/local/bin:/opt/local/sbin:$PATH:/path/to/java/bin
or
export PATH=/opt/local/bin:/opt/local/sbin:/path/to/java/bin:$PATH
Open up terminal and start editing .bash_profile
vi ~/.bash_profile
then add the following
export JAVA_HOME=/usr/java/jdk<your JDK folder>
export PATH=$PATH:/usr/java/jdk<your JDK folder>/bin
Save and close.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With