diff --git a/src/main/java/picocli/CommandLine.java b/src/main/java/picocli/CommandLine.java index d95fcb2d9..6a0f589ce 100644 --- a/src/main/java/picocli/CommandLine.java +++ b/src/main/java/picocli/CommandLine.java @@ -18979,7 +18979,11 @@ private static Properties loadProperties(CommandSpec commandSpec) { if (file.canRead()) { return createProperties(file, commandSpec); } else { - URL resource = commandSpec.userObject().getClass().getClassLoader().getResource(propertiesFileName); + Object userObject = commandSpec.userObject(); + if (userObject == null) { + userObject = commandSpec.commandLine; + } + URL resource = userObject.getClass().getClassLoader().getResource(propertiesFileName); Tracer tracer = CommandLine.tracer(); if (resource != null) { file = new File(resource.getFile());