
WebSphere requires Java, so you would only uninstall Java if you have two or more installations of Java. The imcl (Installation Manager command line tool) with the listInstalledPackages -long option can be used to list the installed packages.
~]# /opt/IBM/InstallationManager/eclipse/tools/imcl listInstalledPackages -long
/opt/WebSphere/AppServer : com.ibm.websphere.IBMJAVA.v80_8.0.5037.20190801_0015 : IBM WebSphere SDK Java Technology Edition (Optional) : 8.0.5.37
/opt/WebSphere/AppServer : com.ibm.websphere.ND.v90_9.0.5007.20210301_1241 : IBM WebSphere Application Server Network Deployment : 9.0.5.7
Notice there are two packages in this example, Java version 8.0.5.37 and WebSphere Network Deployment (ND) Manager (dmgr) version 9.0.5.7. With WebSphere version 9, Java is included (bundled) in the WebSphere package.
The managesdk.sh -listAvailable -verbose command can be used to display the installed Java versions (1.8_64 and 1.8_64_bundled in this example) and where Java resides on the file system (${WAS_INSTALL_ROOT}/java and ${WAS_INSTALL_ROOT}/java_1.8_64 in this example).
~]# ${WAS_INSTALL_ROOT}/bin/managesdk.sh -listAvailable -verbose
CWSDK1005I: SDK name: 1.8_64
- com.ibm.websphere.sdk.version.1.8_64=1.8
- com.ibm.websphere.sdk.bits.1.8_64=64
- com.ibm.websphere.sdk.location.1.8_64=${WAS_INSTALL_ROOT}/java
- com.ibm.websphere.sdk.platform.1.8_64=linux
- com.ibm.websphere.sdk.architecture.1.8_64=x86_64
- com.ibm.websphere.sdk.nativeLibPath.1.8_64=${WAS_INSTALL_ROOT}/lib/native/linux/x86_64/
CWSDK1005I: SDK name: 1.8_64_bundled
- com.ibm.websphere.sdk.version.1.8_64_bundled=1.8
- com.ibm.websphere.sdk.bits.1.8_64_bundled=64
- com.ibm.websphere.sdk.location.1.8_64_bundled=${WAS_INSTALL_ROOT}/java_1.8_64
- com.ibm.websphere.sdk.platform.1.8_64_bundled=linux
- com.ibm.websphere.sdk.architecture.1.8_64_bundled=x86_64
- com.ibm.websphere.sdk.nativeLibPath.1.8_64_bundled=${WAS_INSTALL_ROOT}/lib/native/linux/x86_64/
setupSdk script
The _setupSdk.sh script may contain a line like this.
PROFILE_COMMAND_SDK=1.8_64
If _setupSdk.sh has the version of Java SDK that you are going to be uninstalling,
- Stop the application servers in the profile.
- Stop the nodes in the profile.
Then update PROFILE_COMMAND_SDK in _setupSdk.sh to have the correct version of Java.
AVOID TROUBLE
Be aware that there may be two different directories that contain the _setupSdk.sh.
- /opt/WebSphere/AppServer/bin/sdk/_setupSdk.sh
- /opt/WebSphere/AppServer/profiles/your_profile/bin/sdk/_setupSdk.sh
Setting Profile / Command Java SDK
Before uninstalling Java, the managesdk.sh -getCommandDefault command can be used to determine what version of Java is being used by commands (1.8_64 in this example).
~]# ${WAS_INSTALL_ROOT}/bin/managesdk.sh -getCommandDefault
CWSDK1006I: COMMAND_DEFAULT_SDK: 1.8_64
The managesdk.sh -setCommandDefault command can be used to change commands to use a different Java version.
${WAS_INSTALL_ROOT}/bin/managesdk.sh -setCommandDefault -sdkname 1.8_64_bundled
The managesdk.sh -getNewProfileDefault command can be used to determine what version of Java is being used by commands (1.8_64 in this example).
~]# ${WAS_INSTALL_ROOT}/bin/managesdk.sh -getNewProfileDefault
CWSDK1007I: New profile creation SDK name: 1.8_64
The managesdk.sh -setNewProfileDefault command can be used to change commands to use a different Java version.
${WAS_INSTALL_ROOT}/bin/managesdk.sh -setNewProfileDefault -sdkname 1.8_64_bundled
The managesdk.sh -listEnabledProfileAll command can be used to determine what version of Java is being used by profiles and servers.
~]# ${WAS_INSTALL_ROOT}/bin/managesdk.sh -listEnabledProfileAll
CWSDK1004I: Profile Profile01 :
CWSDK1006I: PROFILE_COMMAND_SDK = 1.8_64
CWSDK1008I: Node Node01 SDK name: 1.8_64
CWSDK1009I: Server Server01 SDK name: 1.8_64
CWSDK1009I: Server Server02 SDK name: 1.8_64
The managesdk.sh -enableProfileAll command can be used to change profiles to use a different Java version.The -enableServers option must be included to update servers to use the versions of Java SDK that was specified.
AVOID TROUBLE
The node that contains the servers will need to be up and running. Also, if the node is federated into a deployment manager, the node agent will need to be up and running and the node agent will need to be synchronized with the deployment manager.
${WAS_INSTALL_ROOT}/bin/managesdk.sh -enableProfileAll -sdkname 1.8_64_bundled -enableServers
Uninstall Java using Installation Manager
The imcl (Installation Manager command line tool) with the uninstall can be used to uninstall a package.
- Stop the application servers in the profile.
- Stop the nodes in the profile.
In this example, the com.ibm.websphere.IBMJAVA.v80_8.0.5037.20190801_0015 package (Java 8.0.5.37) will be uninstalled.
/opt/IBM/InstallationManager/eclipse/tools/imcl uninstall
com.ibm.websphere.IBMJAVA.v80_8.0.5037.20190801_0015
-installationDirectory /opt/WebSphere/AppServer
-showProgress
Upon completion of the uninstall, if no issues were detected, something like this should be displayed.
Uninstalled com.ibm.websphere.IBMJAVA.v80_8.0.5037.20190801_0015 from the /opt/WebSphere/AppServer directory
Then start the nodes.
After the uninstall, there may still be some files and directories left over. If you are absolutely certain that you will have no need for the left over files and directories, remove the left over files and directories.
rm -rf /opt/WebSphere/AppServer/java
Did you find this article helpful?
If so, consider buying me a coffee over at