Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is Minecraft able to function without a META-INF folder?

Tags:

java

minecraft

I really don't understand how this works. I'm trying to build a .jar right now. It consists of two classes: Test.class and Sayer.class. And it works just fine if I access Test.class directly, or properly pack Test.jar, but the only way I can get a jar to execute is if I pack it with a manifest (jar cfm Test.jar manifest Test.class Sayer.class).

If I don't do that, I get an error when trying to run the jar: Error: Invalid or corrupt jarfile Test.jar. This also happens if I build the "good" jar, and remove META-INF/

This perfectly makes sense on its own. After all, you need some way of telling Java where to look for the entry point...right? But then you have Minecraft's modding community, which routinely recommends removing META-INF to make a given mod work.

But, how is Minecraft able to function without a META-INF folder? According to my experiments, this shouldn't even be possible. Shouldn't this corrupt minecraft.jar just like it corrupted my Test.jar?

like image 697
Braden Best Avatar asked Apr 07 '26 05:04

Braden Best


1 Answers

Since MineCraft is run from a launcher, the launcher itself can pass the appropriate startup class to Java directly without needing a META-INF folder.

like image 89
Powerlord Avatar answered Apr 20 '26 18:04

Powerlord