
checkDuplicateJars.bat utility
The checkDuplicateJars.bat utility helps identify and resolve
library conflicts by detecting duplicate JAR files in the HCL Commerce
Developer toolkit. Duplicate JARs occur when multiple versions of the same artifact (for
example, logging-1.1.jar and logging-1.2.jar) exist in
the same directory, which can lead to classpath conflicts and unpredictable runtime
behavior.
This utility provides an interactive interface to review and remove redundant libraries, helping maintain a clean and predictable classpath.
Guidelines
- The utility does not scan subdirectories. Specify the path for subfolders explicitly.
- The utility processes only
.jarfiles. - If no duplicate JARs are found, the interactive cleanup option is not displayed.
How it works
The utility performs the following actions:
- Scans the specified directory for
.jarfiles. - Identifies duplicate JARs (same artifact name with different versions).
- Displays duplicate entries in the terminal.
- Provides an interactive option to review and delete redundant JAR files.
Procedure
- Open a command prompt.
- Change to the following
directory:
WCDE_installdir/bin/ - Run the following
command:
checkDuplicateJars.bat [directory] - Provides an interactive option to review and delete redundant JAR files.
Parameter
- directory (Optional)
- Specify the full path of the folder that contains the JAR files. If you do not provide a path, the script uses the default HCL Commerce toolkit path.
- -h / --help
- Displays the usage information for the utility.
Examples
- Scan the default Toolkit
directory:
checkDuplicateJars.bat - Scan a specific Search EAR library
folder:
checkDuplicateJars.bat C:\HCL\WCDE_V9\workspace\search-ear\lib
Interactive cleanup
If the utility detects duplicate JAR files, it provides an interactive cleanup process:
- Initial prompt
-
Do you want to review and clean duplicate libraries now [Y,N]? - Selection options
-
- Enter a number → Select the corresponding JAR for deletion.
- Enter 0 → Skip the current group.
- Enter Q → Quit the process.
- Confirmation
-
Confirm deletion [Y/N]?