通过managesdk.sh
或managesdk.bat
,我可以使用以下命令获取特定配置文件使用的JDK版本:
managesdk.bat -listEnabledProfile -profileName myProfile
它打印的内容如下:
CWSDK1004I: Profile myProfile :
CWSDK1006I: PROFILE_COMMAND_SDK = 1.8_64
CWSDK1008I: Node liferay-node SDK name: 1.8_64
CWSDK1009I: Server server1 SDK name: 1.8_64
CWSDK1001I: Successfully performed the requested managesdk task.
但是,如果我可以执行命令来获取实际的JAVA_HOME路径,那么我想做的事情会更好。我知道它会在启动服务器时打印出来,我可以在SystemOut.log中找到它。
但是,是否有任何命令可以在不启动服务器的情况下将其打印出来?
如果您知道磁盘上配置文件的路径:
(unset JAVA_HOME; source profiles/XXX/bin/setupCmdLine.sh; echo $JAVA_HOME)
如果您愿意进行一些解析(如果您需要变量中的路径(,则可以在某些命令上使用-verbose
选项来打印额外的属性:
managesdk.bat -listEnabledProfile -profileName myProfile -verbose
这将转储一些额外的属性,包括 SDK 路径(查找com.ibm.websphere.sdk.location
.(
CWSDK1004I: Profile dmgr90 :
CWSDK1006I: PROFILE_COMMAND_SDK = 8.0_64
- com.ibm.websphere.sdk.version.8.0_64=8.0
- com.ibm.websphere.sdk.bits.8.0_64=64
- com.ibm.websphere.sdk.location.8.0_64=${WAS_INSTALL_ROOT}/java/8.0
- com.ibm.websphere.sdk.platform.8.0_64=linux
- com.ibm.websphere.sdk.architecture.8.0_64=x86_64
- com.ibm.websphere.sdk.nativeLibPath.8.0_64=${WAS_INSTALL_ROOT}/lib/native/linux/x86_64/
CWSDK1008I: Node dmgrNode SDK name: 8.0_64
- com.ibm.websphere.sdk.version.8.0_64=8.0
- com.ibm.websphere.sdk.bits.8.0_64=64
- com.ibm.websphere.sdk.location.8.0_64=${WAS_INSTALL_ROOT}/java/8.0
- com.ibm.websphere.sdk.platform.8.0_64=linux
- com.ibm.websphere.sdk.architecture.8.0_64=x86_64
- com.ibm.websphere.sdk.nativeLibPath.8.0_64=${WAS_INSTALL_ROOT}/lib/native/linux/x86_64/
CWSDK1009I: Server dmgr SDK name: 8.0_64
- com.ibm.websphere.sdk.version.8.0_64=8.0
- com.ibm.websphere.sdk.bits.8.0_64=64
- com.ibm.websphere.sdk.location.8.0_64=${WAS_INSTALL_ROOT}/java/8.0
- com.ibm.websphere.sdk.platform.8.0_64=linux
- com.ibm.websphere.sdk.architecture.8.0_64=x86_64
- com.ibm.websphere.sdk.nativeLibPath.8.0_64=${WAS_INSTALL_ROOT}/lib/native/linux/x86_64/
CWSDK1001I: Successfully performed the requested managesdk task.
请参阅此处的文档:managesdk 命令