Source:
<code><START> public String[][] getClasspathAndModulepath(ILaunchConfiguration config) throws CoreException { <END> IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(config); entries = JavaRuntime.resolveRuntimeClasspath(entries, config); LinkedHashSet<String> classpathEntries = new LinkedHashSet<>(entries.length); LinkedHashSet<String> modulepathEntries = new LinkedHashSet<>(entries.length); LinkedHashMap<String, String> moduleToLocations = new LinkedHashMap<>(); for (IRuntimeClasspathEntry entry : entries) { String location = entry.getLocation(); if (location != null) { if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { classpathEntries.add(location); } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.CLASS_PATH) { classpathEntries.add(location); } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.MODULE_PATH) { modulepathEntries.add(location); } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.PATCH_MODULE) { IModuleDescription moduleDescription = entry.getJavaProject().getModuleDescription(); if (moduleDescription != null) { String moduleName = moduleDescription.getElementName(); String locations = moduleToLocations.get(moduleName); if (locations == null) { moduleToLocations.put(moduleName, location); } else { moduleToLocations.put(moduleName, locations + File.pathSeparator + location); } } else { } } } } String[][] path = new String[moduleToLocations.isEmpty() ? 2 : 3][entries.length]; path[0] = classpathEntries.toArray(new String[classpathEntries.size()]); path[1] = modulepathEntries.toArray(new String[modulepathEntries.size()]); if (!moduleToLocations.isEmpty()) { String[] strings = new String[moduleToLocations.size()]; int idx = 0; for (Entry<String, String> entry : moduleToLocations.entrySet()) { strings[idx++] = entry.getKey() + '=' + entry.getValue(); } path[2] = strings; } return path; }</code><technical_language>I personally prefer a dedicated type for return value. Fiddling multi-dimensional arrays code unreadable unmaintainable, beginning</technical_language>

Target:
public String[][] getClasspathAndModulepath(ILaunchConfiguration config) throws CoreException { IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedRuntimeClasspath(config); entries = JavaRuntime.resolveRuntimeClasspath(entries, config); String[][] path = new String[2][entries.length]; List<String> classpathEntries = new ArrayList<>(entries.length); List<String> modulepathEntries = new ArrayList<>(entries.length); Set<String> classpathSet = new HashSet<>(entries.length); Set<String> modulepathSet = new HashSet<>(entries.length); for (IRuntimeClasspathEntry entry : entries) { String location = entry.getLocation(); if (location != null) { if (entry.getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { if (!classpathSet.contains(location)) { classpathEntries.add(location); classpathSet.add(location); } } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.CLASS_PATH) { if (!classpathSet.contains(location)) { classpathEntries.add(location); classpathSet.add(location); } } else if (entry.getClasspathProperty() == IRuntimeClasspathEntry.MODULE_PATH) { if (!modulepathSet.contains(location)) { modulepathEntries.add(location); modulepathSet.add(location); } } } } path[0] = classpathEntries.toArray(new String[classpathEntries.size()]); path[1] = modulepathEntries.toArray(new String[classpathEntries.size()]); return path; }