I stored an xml file in the JARs META-INF directory and want to read that file using a path relative to the JARs root
this is what I'm doing:
ClassLoader cl = Thread.currentThread().getContextClassLoader();
URL url = cl.getResource( "META-INF/test.xml" );
Initializer init = new Initializer(new File(url.getFile()).getAbsolutePath());
The absolute path is returned as: C:/Jar_root/abc.jar!/META-INF/test.xml
If I try to use this as a file path I get a FileNotFoundException due to a illegal path syntax.
I need to use it this because inside the jar i have an entry point function, and I want to be able to run this:
C:\Jar_root\java -jar abc.jar
inside this jar, the first thing it'll do is it needs to go to the xml file stored inside the META-INF directory to get some information.
and I can't figure why it's complaining about the FileNotFound. it's trying to get into the jar file, but it can't.
any help is much appreciated! thanks