是否可以在不启动 WebSphere 中的服务器的情况下从命令行打印特定配置文件使用的 JAVA_HOME 路径
Is it possible to print the JAVA_HOME path used by a specific profile from command line without starting the server in WebSphere
使用 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.
中找到它
但是,有没有不用启动服务器就打印出来的命令呢?
如果你愿意做一点解析(如果你需要变量中的路径),你可以在一些命令上使用 -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 command
如果您知道您的个人资料在磁盘上的路径:
(unset JAVA_HOME; source profiles/XXX/bin/setupCmdLine.sh; echo $JAVA_HOME)
使用 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.
中找到它但是,有没有不用启动服务器就打印出来的命令呢?
如果你愿意做一点解析(如果你需要变量中的路径),你可以在一些命令上使用 -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 command
如果您知道您的个人资料在磁盘上的路径:
(unset JAVA_HOME; source profiles/XXX/bin/setupCmdLine.sh; echo $JAVA_HOME)