tebreca Posted October 9, 2019 Share Posted October 9, 2019 (edited) So I was trying to get a few files unpacked into a subfolder within the Minecraft profile. I got the folder and such working, but I didn't want to write an API for fetching the files from my file server. As the files may differ between versions of my mod. So I decided to just pack them in the jar, which works fine, but like I expected the following line of code doesn't work. InputStream inputStream = FolderManager.class.getResourceAsStream("files.json"); I figured this had to do with the fact that the mods are programmatically loaded in. Is there an easy way for me to access these files I packed? I will make this API for the long term, but unless there's no alternative I'm not yet planning on making it. Thanks Edited October 9, 2019 by tebreca added solved tag Quote Link to comment Share on other sites More sharing options...
tebreca Posted October 9, 2019 Author Share Posted October 9, 2019 I placed the file in the resources folder, it showed up in the jar when I opened it up with WinZip. this is what happens while debugging. I got the same error when running it in a client with the jar compiled, may that make a difference with runClient. Quote Link to comment Share on other sites More sharing options...
tebreca Posted October 9, 2019 Author Share Posted October 9, 2019 41 minutes ago, diesieben07 said: Read the documentation for Class#getResourceAsStream. You did not provide an absolute path, so it will look in the current package. oh ok, thanks! I should've done that before asking here, my bad Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.