I have a plugin that copies an included resource u...
# community-support
d
I have a plugin that copies an included resource using getResourceAsStream. This works just fine in unix/linux OS'es, but not so much on Windows (code simplified to show just the problem) The resourceFile is a string that contains a relative path ('common-config/checkstyle/checkystyle.xml')
Copy code
ClassLoader classLoader = FileUtil.class.getClassLoader();
try (InputStream inputStream = classLoader.getResourceAsStream(resourceFile)) {
    Files.copy(inputStream, config.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
The inputStream is null when running on windows, though the jar properly has the file in it, and the path to the resourceFile is correct. Any ideas why Windows classloader would have different results?
v
Maybe different Java versions where on Windows you have a newer version with stricter encapsulation?
d
interesting idea, but both systems running with JDK17 gradle 9.1.0
v
Then it's probably impossible to guess without debugging what happesn