SD12
SD12

Reputation: 81

Could not find or load main class net.fabricmc.devlaunchinjector.Main fabricmc

I was programming a fabric minecraft mod in intellij and when I ran the code it said :

Could not find or load main class net.fabricmc.devlaunchinjector.Main

When I compiled the code and tried it in minecraft it worked, but in intellij i couldn't run it.

Upvotes: 5

Views: 16595

Answers (5)

BigBoss 369
BigBoss 369

Reputation: 1

I had the same problem. Everything was working fine until, all of a sudden, the mod refused to start due to the missing class, even though I hadn't touched any of the mod's libraries.

I managed to fix the issue in a really weird way and still don't understand what caused it, or how this solution fixed it. I simply copied the .idea folder, then deleted it and restarted IntelliJ. After the restart, IntelliJ had recreated the .idea folder, but I deleted it again and replaced it with my original copy.

Upvotes: 0

Hein
Hein

Reputation: 183

Deleting the .idea folder and restarting IntelliJ solved the issue for me.

Upvotes: 1

Jeremy Rivera
Jeremy Rivera

Reputation: 41

thecoopsyt's answer worked for me.

Go to Gradle tab > Reload All Gradle Projects

Wait a few mins for it to check and update your dependencies.

After this I was able to return to testing my project in Intellij... had to fully compile and test before this fix.

Upvotes: 2

thecoopsyt
thecoopsyt

Reputation: 1

In Intellij gradle if

this doesn't work you can put

downloadAssets runClient into a gradle config and it will start a client and download the net.fabricmc.devlauncherinjector.Main this allows you to use gradles built in Minecraft Client

Upvotes: -1

SD12
SD12

Reputation: 81

I was messing around with the files, to see if I can fix it and I found a solution :

  1. Go to "Run Configuration", press the arrow to see the options and tap "Edit Configurations" Go to "Minecraft Client" and press the button next to "net.fabricmc.devlaunchinjector.Main" search trough your external libraries and find "net.fabricmc.devlauncherinjector.Main" (it must be right under net.fabricmc-api...) select it, and after that you should see the "Edit Configurations" window. Press "OK"
  2. If this doesn't work, right click the file and select "Copy Full Path". Then go to "Edit Configurations" window and paste it where it says "net.fabricmc.devlauncherinjector.Main"
  3. If the 2 option doesn't work either, close the project, copy the mod folder, and paste it somewhere else(eg. Desktop, New Folder). And then open your IDE, go to open project and select the copied folder. Press the "Build.gradle" file and select open as project and "Trust" .It should now work. If it doesn't , unfortunately I don't know how to fix it.

Upvotes: 3

Related Questions