Home > Software engineering >  Java: could not find or load main class main - not sure why
Java: could not find or load main class main - not sure why

Time:11-23

I am trying to upload a .jar file onto eclipse in order to be able to edit it.

The purpose of the .jar file is to track player coordinates on minecraft.

I have decompiled this .jar file on Eclipse, using the eclipse Java Decompiler.

However, when I try to run this decompiled code, I am getting the error: 'Could not find or load main class main'.

This happens when I try to run the 'decompiled code' by creating a run configuration and specify the main class: 'main'.

I have looked at other forums on this topic and have tried different things without success. However, none of these options have worked.

The decompiled 'main.class' file is currently stored within the 'JRE system library' folder. Is this the wrong place to store it?

I would be so grateful for a helping hand!

I have provided an image of the decompiled code:

enter image description here

And the run configuration tab, where I specify how I want the code to run.

enter image description here

CodePudding user response:

I have now created a plugin using 'Maven', which allows me to edit the code given that to use Bukkit as an API requires the tool 'Maven'.

https://bukkit.fandom.com/wiki/Plugin_Tutorial_(Eclipse)#Example_Files_and_Templates

Thanks so much for the help :)

CodePudding user response:

It looks like your 'main' class is in the 'tracker' package. So the correct main class would be 'tracker.main'.

I hope this could help you.

  • Related