diff --git a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/Tensorflow2Interface.java b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/Tensorflow2Interface.java index 7f4ae0f..a09d7be 100644 --- a/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/Tensorflow2Interface.java +++ b/src/main/java/io/bioimage/modelrunner/tensorflow/v2/api050/Tensorflow2Interface.java @@ -54,7 +54,6 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.security.CodeSource; import java.security.ProtectionDomain; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -146,6 +145,10 @@ public class Tensorflow2Interface implements DeepLearningEngineInterface { * File extension for the temporal files used for interprocessing */ final private static String FILE_EXTENSION = ".dat"; + /** + * Name without vesion of the JAR created for this library + */ + private static final String JAR_FILE_NAME = "dl-modelrunner-tensorflow-"; /** * The loaded Tensorflow 2 model @@ -675,6 +678,8 @@ private List getProcessCommandsWithoutArgs() throws IOException, URISynt String codeSource = protectionDomain.getCodeSource().getLocation().getPath(); String f_name = URLDecoder.decode(codeSource, StandardCharsets.UTF_8.toString()); for (File ff : new File(f_name).getParentFile().listFiles()) { + if (ff.getName().startsWith(JAR_FILE_NAME) && !ff.getAbsolutePath().equals(f_name)) + continue; classpath += ff.getAbsolutePath() + File.pathSeparator; } String className = Tensorflow2Interface.class.getName();