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

I am attempting to use the javax-usb API  in my client only mod.

I've got everything working in the dev environment, but it has this requirement that it needs a properties file in the "root of the classpath."  

It uses this line to pull that file:

UsbHostManager.class.getClassLoader().getResourceAsStream(JAVAX_USB_PROPERTIES_FILE);

where JAVAX_USB_PROPERTIES_FILE is just the name of the file it is looking for without any subdirectory.

The relevant package is shadowed into the jar and the properties file is at the root of the jar.  Everything looks right to me, but it can't find the file.

I also tried running MY_MOD_CLASS.class.getClassLoader().getResourceAsStream(JAVAX_USB_PROPERTIES_FILE); in case the shadowing had messed something up.  It still comes back null.

I've been struggling with this for a while.  My only conclusion is that getResourceAsStream must not search the way I thought it did.  I'd appreciate any direction you can give.

Thanks.

 

 

  • Author

I figured this out.  Turns out, it's not really Forge related, but I'll leave the answer here in case it helps someone else out.

The package is javax.usb. 

The file is javax.usb.properties.

I was having some issues so when I shadowed in the package, so I told shadow to relocate it to com.github.theredwagoneer.javax.usb.

What I didn't know is that besides relocating actual package references, shadow actually relocated strings that match the package pattern.  However, it didn't rename resource filenames or resource file contents.  So the mod was looking for  com.github.theredwagoneer.javax.usb.properties, but all that was there was javax.usb.properties.  The string inside the file needed to change too.  Relocated those manually.  All works now.

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.