Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Minecraft Modding Error: Could not find or load main class


Xdot
 Share

Recommended Posts

Hello,

I'm trying to code a Minecraft mod for forge using IntelliJ IDE. I am running into issues when I try to run the mod in the IDE. I get an error message that reads the following:

"Error: Could not find or load main class"

I'm rather new to modding and I am not sure what is giving me this error message, If anyone has seen this before or has any suggestions any help would be greatly appreciated!

Link to comment
Share on other sites

Posted (edited)

I did add a Mod ID to the main class (if that's the same thing as a "mod annotation"). It looks something like this:

@Mod("lca")

As for setting up my workspace, I downloaded the latest java8 download, created a new PATH variable to the JDK, I then downloaded IntelliJ Community Edition, And a forge 1.18.2 MDK. I then opened the MDK in the IDE and changed only what was necessary for the mod to run (the mod ID in the main class + what was marked as mandatory in the mods.toml file). Next via command prompt, I generated the "runs" to run my mod in the IDE. Finally, I selected "Run Client" in the Run/Debug Configurations.

One thing you might want to note, and I don't know if this has anything to do with my current issue, was that the first time I had tried to run the mod in the IDE, I got a different error message that read the following:

Unrecognized option: -p
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I managed to fix this error by going into the Run/Debug Configurations and deleting a line of code that said only "-p" under the "Build and Run" Section.

Edited by Xdot
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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.