Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 by tebreca
added solved tag

  • Author

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.image.png.7f58fee4399890c0bf5ad1a4defd71e2.png

  • Author
  On 10/9/2019 at 4:33 PM, 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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.