Error: Could not find or load main class main while executing jar file
已回答
I can't execute my jar file. When i click on it nothing happens. When i execute it from cmd it gives Error: Could not find or load main class main
Caused by: java.lang.ClassNotFoundException: main error. I am choosing the main file when it asked from me. I tried a few solutions but nothing happened please help.


请先登录再写评论。
Please see https://stackoverflow.com/a/42660624/104891 and https://stackoverflow.com/a/42200519/104891 for the sample project with the executable jars.
open your generated jar file with 7zip. Go to folder META-INF. Delete all files with extension *.sf, *.rsa, *.ds
close 7zip
run java -jar yourjar.jar
enjoy!!!
@garawaa Hey you saved my life. I've been suffering this error over 2 weeks. Thanks a lot!
@gaewaa, your answer takes effect to my case. You saved my life. Thanks a lot!!
Hey garawaa ! Tanks for your help man ! Did you have some explanation about the root cause of this problem on IntelliJ ?