URL[] () { return myClasspath.stream().map(f -> { try { URL fileURL = f.toURI().toURL(); if (!fileURL.getProtocol().equals("file")) { throw new RuntimeException("Remote resources are not allowed in the classpath: " + fileURL); } return fileURL; } catch (MalformedURLException e) { throw new RuntimeException("Failed to get URL for " + f + ". " + e.getMessage(), e); } }).toArray(sz -> new URL[sz]); }