File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes When I Run Main Project in NetBeans (F6) It always runs a project that isn't even open Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "When I Run Main Project in NetBeans (F6) It always runs a project that isn Watch "When I Run Main Project in NetBeans (F6) It always runs a project that isn New topic
Author

When I Run Main Project in NetBeans (F6) It always runs a project that isn't even open

David Ausman
Greenhorn

Joined: Jan 04, 2009
Posts: 12
I'm new to using NetBeans and Java but am learning lots from the book Head First Java which I love.

However, I am having a problem with NetBeans when I click on the green arrow(Run Main Project F6) button. It keeps trying to run my project and then looks for a class in another completely unrelated project, which isn't even open. I don't understand how that can be happening. This class is not even in my code yet it is trying to compile with it. I have attached a screen print.

I am running the BeatBox application from the book and it keeps looking for the QuizCardBuilder class, which is in another project. This happens even if I open ANY other unrelated projects and try to run them. They all keep asking for the QuizcardBuilder class. It's crazy.



[Thumbnail for NetBeansIssue2.jpg]

Tom Johnson
Ranch Hand

Joined: May 11, 2005
Posts: 142
Can you try right clicking on the project you want to execute and click Run, rather than using run main project. I suspect its always running the project that has been set as main project when you hit F6


<a href="http://faq.javaranch.com/java/UseCodeTags" target="_blank" rel="nofollow">Use Code Tags!!</a>
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38045
    
  22
If at all possible, don't use IDEs until you are a lot more experienced. You quote the name of the class with your main method at the command line/terminal

javac MyClass.java
java MyClass

Note when you do and don't use extensions.
David Ausman
Greenhorn

Joined: Jan 04, 2009
Posts: 12
I'm going to take your advice and stop using the IDE for now. I just started using it for the last few projects because it looked like it made things easier but it's caused more confusion. I wasn't having any problems when I was running things from the DOS prompt.

Thanks again.
 
Consider Paul's rocket mass heater.
 
subject: When I Run Main Project in NetBeans (F6) It always runs a project that isn't even open
 
Similar Threads
Class instantiation within the same class
QuizCard class not found. (Head First Java 2nd Ed)
sequence of Head First series - which?
netbeans - Servlet
Getting my main class and GUI components to talk without inner classes