
PS: It does work if i checked the main class template. when i try to run from the top toolbar, it tells me to edit the configurations, i chose applications and when i see the class to choose as main class, it doesn't let me choose (the ok button is greyed out).ĭoes anyone have solutions for this particular problem? D:Sample>java HelloJava.class Error: Could not find or load main class HelloJava.class Caused by: : HelloJava.class If we try to execute without the file extension, it will execute successfully. E:java-examplessrc> javac comhowtodoinjavacorebasicMainClass.java. Attempting to execute MainClassName does not work, because no class having that name exists.

This is because it must be called with its fully qualified class name: Here you can see, the name of this class is not MainClassName, Its packageName.MainClassName. The correct way to compile and execute this class is : How to compile and execute class. You will get 'Error: Could not find or load main class MainClassName'. When i try to run by right clicking the class, there is no run button (i have picked the src folder as sources root). If we want to execute the main () method in MainClass, we must use the full class name, including package name, in the java command. You may see that main class is added into MANIFEST and location of manifest is also. which is created in IntelliJ where I want to build JAR file So what I did: Ensure that MANIFEST.MF is located in srcmainresourcesMETA-INF as it is already mentioned somewhere here on the site. I've been trying to create new project without the template, so i can edit the Main class name to my liking.īut the problem is, it doesn't let me run the class i created, i have searched all over the internet to find the solutions, and found none. idea intellij Could not find the main class idea intellijGroovyjavagroov圜ould not find the main classgroovyjavagroovysrctest main. IntelliJ build wrong JAR: Could not find or load main class.
