diff --git a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java index c230b49e1cde..23f204a2bbcd 100644 --- a/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java +++ b/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java @@ -1225,13 +1225,15 @@ private int completeImageBuild() { if (!imageNamePathParent.isAbsolute()) { imageNamePathParent = imagePath.resolve(imageNamePathParent); } - if (!Files.isDirectory(imageNamePathParent)) { - throw NativeImage.showError("Writing image to non-existent directory " + imageNamePathParent + " is not allowed. " + - "Create the missing directory if you want the image to be written to that location."); - } - if (!Files.isWritable(imageNamePathParent)) { - throw NativeImage.showError("Writing image to directory without write access " + imageNamePathParent + " is not possible. " + - "Ensure the directory has write access or specify image path with write access."); + if (!useBundle()) { + if (!Files.isDirectory(imageNamePathParent)) { + throw NativeImage.showError("Writing image to non-existent directory " + imageNamePathParent + " is not allowed. " + + "Create the missing directory if you want the image to be written to that location."); + } + if (!Files.isWritable(imageNamePathParent)) { + throw NativeImage.showError("Writing image to directory without write access " + imageNamePathParent + " is not possible. " + + "Ensure the directory has write access or specify image path with write access."); + } } imagePath = imageNamePathParent; /* Update arguments passed to builder */