Java Path Setup / Java 路徑設定

For Mac OSX 10.5 or later

In Mac OSX 10.5 or later, Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home,
just export $JAVA_HOME in file ~/. bash_profile or ~/.profile.

 

For Linux

For each user,  user can add the java path in  ~/. bash_profile or ~/.profile.
For all users,  system admin can add the java path in /etc/profile

To find java path location, try one of followings

  • update-java-alternatives -l
  • cd /
    find . -name ‘javac’                //might need root privilege
  • alternatives –display java
  • sudo update-alternatives –config java
  • Or take look at the following

     –  /usr/local/java/jdk[version]
    –  /usr/lib/jvm/java-1.11.0-openjdk-amd64
    –  /usr/lib/jvm/java-1.8.0-openjdk


    Once the JDK path is found,  we can add into ~/.bash_profile or  ~/.profile as following,

export JAVA_HOME=”path that you found”

export PATH=$JAVA_HOME/bin:$PATH

For Windows   (*Reference : mkyong blog

Find  System Properties (*My Computer > Right Click > Properties)

Add JAVA_HOME

 

ADD JAVA Bin PATH     //Window 7

 

ADD JAVA Bin PATH     //Window 10

 

Last Step,  Let’s run some test

 

以上為安裝JDK 軟體後 ,需做的基本路徑設定。
也希望對各位初學者或是想找路徑的朋友   有些幫助 ~

以上

時賦科技  FRank

Facebook Comments