No Main class found in NetBeans
java, netbeans, netbeans-7, runtime-error
Solution
- Right click on your Project in the project explorer
- Click on properties
- Click on Run
- Make sure your Main Class is the one you want to be the entry point. (Make sure to use the fully qualified name i.e. mypackage.MyClass)
- Click OK.
- Run Project :)
If you just want to run the file, right click on the class from the package explorer, and click Run File, or (Alt + R, F), or (Shift + F6)
Problem
I have been working on an assignment for my class in programming. I am working with NetBeans. I finished my project and it worked fine. I am getting a message that says "No main class found" when I try to run it. Here is some of the code with the main: ``` package luisrp3; import java.io.FileNotFoundException; import java.io.PrintStream; public class LuisRp3 { public static void main(String[] args) throws FileNotFoundException { java.io.File newFile = new java.io.File("LuisRamosp4.txt"); if (newFile.exists()) { newFile.delete(); } System.setOut(new PrintStream(newFile)); Guitar guitar = new Guitar(); ``` I posted this before but had a couple issues. i have fixed the others and now have just this one remaining. Any advice will be greatly appreciated.