This happens as soon as you relocate your main course place manually because Netbeans doesn"t refresh one of its residential property files.Open nbproject/task.properties and readjust the worth of major.course to the correct package area.
You are watching: Class does not have a main method
Exceute the regime by pushing SHIFT+F6, rather of clicking the RUN switch on the home window.This can be silly, bt the error primary course not uncovered is not arising, the job is executing well...
Sometimes passing parameters in the main method reasons this trouble eg. public static void main(String<> args,int a). If you declare the variable external the primary technique, it could aid :)
It was the majority of likely that you capitalized "m" in "main" to "Main"
This occurred to me this prompt but I solved it thanks to the miscellaneous resource code examples offered by all those that responded. Thank you.
in Project window best click on your task and also choose properties go to Run and also collection Key Class ( you deserve to brows it) . this hand-operated job-related if you have actually static major in some class :
public course Someclass /** *
param args the command line arguments */ public static void main(String<> args) //your code Netbeans does not have any type of dispute through W7 and also you have the right to use version 6.8 .
If you called your course with the keyword in Java, your regimen wouldn"t be well-known that it had actually the primary strategy.
This damaged me for a while.... I kbrand-new that tright here HAD to be an much easier method via a world class IDE like Netbeans.
The simplest technique is to push Shift+F11 (Clean and Build Project), then hit F6 to run it.
It refreshes Netbeans accordingly and also finds your primary without all the hand-operated labor; and also if you have multiple mains, it will offer you the alternative to select the correct one.
I had this worry as well (Error: Could not uncover or load primary course test.Test). I"ll describe this reasonably basically considering that I understand I would certainly have appreciated someone doing that as soon as I was in search of my answer.
When I right-clicked on the job (left hand side of the display screen unmuch less you eliminated the tasks tab) and also went to properties and also then run, the primary class had actually the projectname.classname, which is what perplexed me.For instance, I developed a project "test" to test this out, and also when I went to
(right-click) test or Source Packages -> properties -> run -> major class
had Test.test in that field, which is what the problem was. the course is test, not Test.test, so I clicked browse to its ideal, and also the only thing in the list to select from was test, and also once I selected that and tried rerunning it, it finally operated.
See more: Why Can A Paperclip Float On Water Experiment, Float A Paperclip In Water Experiment
In addition, I discovered that when you develop a brand-new project in Netbeans, among the things it originally offers you (in my instance of the project called test) is package test;. If you are having actually this problem, then choose me, you more than likely initially eliminated that line seeing it as just an additional line of code you didn"t require. That line of code is what allowed your primary class which in my case was Test.test to discover the primary course *test from that.