From 25e4c2c8b27c4442dcb5f22a9d2e1355b51592e3 Mon Sep 17 00:00:00 2001 From: Christos Tranoris <tranoris@ece.upatras.gr> Date: Tue, 6 Feb 2024 22:08:22 +0200 Subject: [PATCH] with absolute path, fix for #16 --- .../java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java | 9 +++------ 1 file changed, 3 insertions(+), 6 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 a993c33..a314dcf 100644 --- a/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java +++ b/src/main/java/org/etsi/osl/osom/lcm/LCMRulesExecutor.java @@ -163,16 +163,13 @@ public class LCMRulesExecutor { * This is the location of the jar inside the running container */ - - String path = LCMRulesExecutor.class.getProtectionDomain().getCodeSource().getLocation().getPath(); - String decodedPath = URLDecoder.decode(path, "UTF-8"); - - File classesJar = new File(decodedPath); + String jarpath = new File(ClassLoader.getSystemClassLoader().getResource(".").getPath()).getAbsolutePath(); + File classesJar = new File(jarpath); //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("jarpath = "+ jarpath); logger.debug("optionList = "+ optionList.toString()); -- GitLab