简体   繁体   中英

How do I know if Java is added to the path in Mac?

I'm reading instructions on setting up a thing and it says,

Add the Java bin directory to the PATH variable

Now, I don't remember if I've added it to the path before or not but if I open Terminal and type java -version from the command line and press enter it shows:

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

Does this mean java is already in the path and I don't need to add it? Thanks for all your wonderful support. May your days be filled with flowers and pokemons.

To see how a command resolves to an executable on your $PATH , use the which command

$ which java
/usr/bin/java

… or the equivalent bash builtin, type -p :

$ type -p java
/usr/bin/java

On a Mac OS X system with Oracle Java installed, /usr/bin/java is a symbolic link.

$ ls -l /usr/bin/java
lrwxr-xr-x  1 root  wheel  74 23 Oct 16:23 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM