Changing the path of getClass().getResourceAsStream(PATH) in runtime
Is it possible to change the PATH of the Java code getClass().getResourceAsStream(PATH)
in ru开发者_Python百科ntime? I would like to have an edit box so that the user can specify i.e http://site.com/image.png for the PATH.
You shouldn't use getClass().getResourceAsStream()
if the resource is not on the classpath (i.e., not deployed on your server). It is not what it is intended for.
To load resources from a HTTP URL, use HttpURLConnection
精彩评论