Hi Guys
Thank for comments. Original details were a bit sketchy so for that I apologies.
My original code didn't work as I could find xsd file.
I tried a few approaches so let me try yo explain
EFFORT 1
I moved it up to root of jar file and used following code:
So basically using class loader to get access to resource, creating URI and passing URI to new file.
I work fine in my
IDE when I am developing (gsk2c.xsd is local file) but when I
test shipped jar, I get following error.
Exception : com.gsk.gskgaa.exceptions.GSKGAAException: java.lang.IllegalArgument
Exception: URI is not hierarchical From some research I gather this is widely reported. And of course there is problem because I am using new File(uri), but when deployed my uri NOT a file.... it is embedded in jar file...
Now I as use CLassLoader.getResourceAsINputStream, this give me accurate handle to xsd...... however when setting attribute, I require either a file or file location (as far as I know...), I tried reading actually xsd contents and passin it to setAttribte but I got error again there....
cannot read xsd file etc EFFORT2
I hoped to explicity read file using about approach, so i took file out of jar & added to classpath, however clasloader still looking for file in jar.... I get following NPE as classloader trying to read file from
URL jar:file:/C:/NewAdapter/lib/gskgaa3.012Beta.jar!/gsk2c.xsd FINALLY EFFORT3
I have an external properties file. I am left with specifying explicitly where file is & using the file location when setting attribute. This is very crude but all I'm left with....
So to sumarise.....
I can create an inputstream from file in jar..... but I don't where to go then..... as far as I know I need either a File object or a file location....
Any comments