How to obtain the location of cacerts of the default java installation?

前端 未结 6 660
情书的邮戳
情书的邮戳 2020-12-02 09:56

I am looking on how how to obtain the location of cacerts of the default java installation, when you do not have JAVA_HOME or JRE_HOME

6条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 10:00

    Under Linux, to find the location of $JAVA_HOME:

    readlink -f /usr/bin/java | sed "s:bin/java::"
    

    the cacerts are under lib/security/cacerts:

    $(readlink -f /usr/bin/java | sed "s:bin/java::")lib/security/cacerts
    

    Under mac OS X , to find $JAVA_HOME run:

    /usr/libexec/java_home
    

    the cacerts are under Home/lib/security/cacerts:

    $(/usr/libexec/java_home)/lib/security/cacerts
    

    UPDATE (OS X with JDK)

    above code was tested on computer without JDK installed. With JDK installed, as pR0Ps said, it's at

    $(/usr/libexec/java_home)/jre/lib/security/cacerts
    

提交回复
热议问题