user1650305
user1650305

Reputation:

Load file from classpath without InputStreams

I have a library that cannot accept InputStreams. It only accepts Files and URLs as input to load music. Is there any way to load a file that is in my resources folder without an InputStream? Or do I just need to create a separate folder for sounds and load them using

System.getProperty("user.dir") + path_to_file

Upvotes: 0

Views: 131

Answers (1)

JB Nizet
JB Nizet

Reputation: 691755

Class[Loader].getResource() returns a URL. Use this method to get a URL pointing to your classpath resource, and pass the URL to your library.

Upvotes: 1

Related Questions