From 4212c633b70fb8ac3f19b3e2d3888f4066db1ca8 Mon Sep 17 00:00:00 2001 From: Christos Tranoris <tranoris@ece.upatras.gr> Date: Tue, 6 Feb 2024 21:44:02 +0200 Subject: [PATCH] attempt to fix #16 --- .../java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java index 3edcb15..a993c33 100644 --- a/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java +++ b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java @@ -6,6 +6,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; +import java.net.URLDecoder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -162,10 +163,16 @@ public class LCMRulesExecutor { * This is the location of the jar inside the running container */ - File classesJar = new File("/opt/openslice/lib/org.etsi.osl.osom-1.2.0-SNAPSHOT.jar"); + + String path = LCMRulesExecutor.class.getProtectionDomain().getCodeSource().getLocation().getPath(); + String decodedPath = URLDecoder.decode(path, "UTF-8"); + + File classesJar = new File(decodedPath); + //File classesJar = new File("/opt/openslice/lib/org.etsi.osl.osom-1.2.0-SNAPSHOT.jar"); if ( classesJar.exists() ) { optionList.addAll(Arrays.asList("-classpath", classesJar.getAbsoluteFile().toString() )); - } + } + logger.debug("jarpath = "+ decodedPath); logger.debug("optionList = "+ optionList.toString()); -- GitLab