是否可以从命令行打印特定配置文件使用的JAVA_HOME路径,而无需在WebSphere中启动服务器

时间:2018-06-27 10:00:32

标签: websphere websphere-8

使用managesdk.shmanagesdk.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中找到它。

但是,是否有任何命令可以在不启动服务器的情况下将其打印出来?

2 个答案:

答案 0 :(得分:1)

如果您愿意进行一些解析(如果您需要变量中的路径),则可以在某些命令上使用-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.

在此处查看文档:{​​{3}}

答案 1 :(得分:1)

如果您知道磁盘上个人资料的路径:

(unset JAVA_HOME; source profiles/XXX/bin/setupCmdLine.sh; echo $JAVA_HOME)