How do I access a JPG embedded in my JAR file via a URL object? What would be the address?
I've bundled a JPG inside of my application's JAR file. I need to access it, preferably via a URL objec开发者_Python百科t from the code in the same JAR. But I've no idea how to construct the address. I'm guessing it would be a "file:///" but what comes after that?
You can use ClassLoader.getResource
, specifying a slash-delimited resource path.
精彩评论