jar:file:/R:/Program%20Files/Wow!/lib/MyLibrary.jar!/com/dumblux/experiment/Resources/pic.jpg
"Il y a peu de choses qui me soient impossibles..."
Steve
Steve Luke wrote:So my question is why you need the URL? Why not get the stream directly?
"Il y a peu de choses qui me soient impossibles..."
Paul Clapham wrote:What version of Java is that? I ask because handling of file URLs has been rife with errors in earlier versions. There were even versions which didn't URL-escape spaces in file names by %20, but it looks like that at least has been fixed.
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:
Steve Luke wrote:So my question is why you need the URL? Why not get the stream directly?
I hadn't tried that, but after trying it, the answer seems to be that getResourceAsStream returns null.
url = new URL("jar:file:/R:/Program%20Files/Wow%21/lib/MyLibrary.jar!/com/dumblux/experiment/Resources/pic.jpg");
Steve
Steve Luke wrote:If you open the JAR file and inspect it, where is the Resources folder? Is it at the top level (MyLibrary.jar!/Resources/) or is it in the package with MyClass (MyLibrary.jar!/com/dumblux/experiment/Resources/) or someplace else? From the null return I expect it is at the top level and you should use the absolute path MyClass.class.getResourceAsStream("/Resources/pic.jpg").
"Il y a peu de choses qui me soient impossibles..."
Stevens Miller wrote:
Steve
Steve Luke wrote:
Stevens Miller wrote:
The file is pic.img, not pic.jpg. So you need to use MyClass.class.getResourceAsStream("Resources/pic.img")
"Il y a peu de choses qui me soient impossibles..."
"Il y a peu de choses qui me soient impossibles..."
Steve
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |