With a double click, I have the error cant find or load main class, and this is on any jar file, i.e. I understand the problem can be in the settings of java on the computer? may need to set up environment variables?
- stackoverflow.com/questions/18093928/… - AK ♦
- @AK Please try to publish detailed answers containing a specific example of the minimum solution, supplementing them with a link to the source. Answers –references (as well as comments) do not add knowledge to the Runet. - Nicolas Chabanovsky ♦
- @NicolasChabanovsky Thanks for the admonition. I will not be justified by the fact that I am new (two weeks is not a term), but I will say that I rarely do so. I already saw on the discussion thread that the answers are better than comments, but in many cases it is enough for people to give a small hint (yes, there sometimes even just formulating a question for so gives a lot to answer), and then they will cope on their own. In this case, there are too many options for topikstarter, so I limited myself to the link. - AK ♦
|
1 answer
There is a Manifest.mf file in the jar file (in the META-INF folder), you need to specify the name of the main class in it, open your jar file with any archiver if you don’t find the Manifest.mf file there, or in the Manifest.mf file itself there will be lines:
Main-Class: [имя вашего главного класса] This means the assembly is not done correctly. The second option, in your classes there is no entry point (main method):
public static void main(String[] args){... there should be one such method for the class containing it to be considered the main one.
|