diff --git a/compiler/core/src/zserio/tools/ExtensionManager.java b/compiler/core/src/zserio/tools/ExtensionManager.java index 851b91234..c88f30709 100644 --- a/compiler/core/src/zserio/tools/ExtensionManager.java +++ b/compiler/core/src/zserio/tools/ExtensionManager.java @@ -145,12 +145,20 @@ private File getWorkingDirectory() { final String execUrlPath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); final String decodedExecUrlPath = URLDecoder.decode(execUrlPath, "UTF-8"); - final Path workingParentPath = Paths.get(new URL(decodedExecUrlPath).toURI()).getParent(); + // check if decodedExecUrlPath is really URL, newer Java versions 11 or 17 returns normal path + File decodedExecFile = null; + try + { + decodedExecFile = new File(new URL(decodedExecUrlPath).toURI()); + } + catch (MalformedURLException | URISyntaxException excpt) + { + decodedExecFile = new File(decodedExecUrlPath); + } - return (workingParentPath == null) ? null : workingParentPath.toFile(); + return decodedExecFile.getParentFile(); } - catch (SecurityException | UnsupportedEncodingException | MalformedURLException | - URISyntaxException excpt) + catch (SecurityException | UnsupportedEncodingException excpt) { return null; }