0

I'm a complete noob and have been trying to set my mac to learn Java. I have installed JDK 10.0.1 and eclipse oxygen. I also successfully edited the JAVA_HOME variable to point to my jdk location using this: Setting JAVA_HOME environment variable on MAC OSX 10.9

So far so good, I was able to run simple programs both on eclipse and on terminal ( was having trouble for a while because I couldn't run "HelloWorld" from terminal as it was under a separate package) after using the top answer from Running java in package from command line

However my friend later told me that if I wanted to run java programs from terminal, I'd need to edit PATH variable as it was where the os looks for executables. A lot of websites mentioned editing PATH as well. I ran echo $PATH and terminal outputted /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin.

So I'm really confused that if I haven't edit PATH, then why am i able to run commands like java or javac from terminal? The /usr/bin folder has java javac javadoc etc aliases inside it, could that be the reason?

4
  • Yes, that is the reason. Commented May 21, 2018 at 23:23
  • @Andreas Thanks! Do the aliases come with the OS or are they added during jdk installation? Commented May 21, 2018 at 23:35
  • @catsRjerks some aliases come with the OS, and when you install the jdk, those java aliases are then added. Commented May 21, 2018 at 23:54
  • @davedwards that makes sense. Thank you. Commented May 22, 2018 at 0:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.