0

Is it possible to change the PATH of the Java code getClass().getResourceAsStream(PATH) in runtime? I would like to have an edit box so that the user can specify i.e http://site.com/image.png for the PATH.

0

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.