In domain mode, I can use the properties file as a module, but the problem is whether there is any modification in the file, then I need to do this for all subordinates in the domain. I want to centralize the file so that at some point I can change, and it will be reflected on all subordinates.
I know that in domain.xml we can configure global level system properties, but I have about 25 properties files.
So, is there a way to centralize files?
myjar.jar -->package --> class -->properties -->xml files
myjar.jar - archived jar file To get XML files
URL url = Thread.currentThread().getContextClassLoader().getResource("./properties"); File queryFolder = new File(url.getFile()); for (File fileName : queryFolder.listFiles()) // null pointer exception { if (fileName.getName().toUpperCase().endsWith("XML")) { saxParser.parse(fileName, this); } }
This does not work.
Tried this
How to list files inside a jar file?
And faced with the same problem below link
JBoss wildfly 8.x Provider "vfs" not installed when using java nio Paths
URL w_url = mmyClass.class.getProtectionDomain().getCodeSource().getLocation(); JarEntry w_ze = null; LOGGER.info("Jar******************" + w_url.toString()); if (w_url.toString().endsWith(".jar")) { try (JarInputStream jar = new JarInputStream(w_url.openStream())) { while ((w_ze = jar.getNextJarEntry()) != null) { LOGGER.info("Name *******" + w_ze.getName()); } } catch(Exception e) { } }
source share