Ubuntu – Error executing a jar file ubuntu

command line

I have been trying for hours on how to get this file to executive. On Windows it starts up successfully but on Ubuntu it does not.

My guess is that I don't have permissions to run the file properly.

Basically I navigate the the folder the jar file is located in with the
Terminal and type in

$ java -jar Bot.jar 

and I get an error saying

Error: Could not find or load main class net.minecraft.client.Main

Ive tried using sudo before the command and using chmod 755 but none of it is working.

Now like I said before this works fine on Windows and I can't seem to find what my issue is.

Best Answer

The error says that there is no main method in the jar file. Not all jar archives are supposed to be executed. Some are libraries, some don't come with a main method on another purpose.

An example of latter is the Minecraft client, which seems to be related to your question. It purposely doesn't have a main method as a rudimentary piracy protection. For it to start, it needs a launcher, which connects to the Mojang server, thereby starting a game session, which is then handed over to the client by calling some method in it.

So if your file - I'll ignore the naming - is a Minecraft client, you need the launcher to run it.

If it is the other way around, and your archive is a Minecraft launcher, you need to tell it where the Minecraft client is located (~/.minecraft/versions/<version>/<version>.jar), maybe by adding it to the PATH environment, maybe by giving it as an argument to the command.

If it is a Minecraft mod, you should have installation instructions along with it.

Related Question