Jump to content

[1.18.2] Trying to import a mod library .jar into my project


Recommended Posts

I'm trying to import classes from this mod library in my project: https://www.curseforge.com/minecraft/mc-mods/ftb-library-forge

I've downloaded the .jar for 1.18.2, placed it in my project root folder and added it in IntelliJ as a module (by going to file -> project structure -> main -> +JARs or directories -> ftb-library-forge-1802.3.6-build.115.jar)

I can import the classes in my code without error and have working autocomplete and inspection:

Except whenever I try to build I get:

error: package dev.ftb.mods.ftblibrary.ui does not exist
import dev.ftb.mods.ftblibrary.ui.BaseScreen;

I've also tried adding it to my classpath (I am on Windows) as suggested by some stackoverflow posts, using:

javac -cp .;./ftb-library-forge-1802.3.6-build.115.jar dev/ftb/mods/ftblibrary/FTBLibrary.java

except this just gives me: error: no source files

Is there something wrong with what I'm doing here and/or is there an alternate way to get this dependency into my project?

Link to comment
Share on other sites

I followed these links but am getting this note on my build.gradle, and the imports are still not found (though strangely, it still lets me run and doesn't error until I try to use the dependency's classes, at which point it throws a NoClassDefFoundError.



Link to comment
Share on other sites

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.

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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