Should the project name of my Java application ?

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 1K views
Math10
Messages
301
Reaction score
0
Should the project name of my Java application must be the same as the name when I save my Java application? Because I'm using Netbeans IDE 8.0.2 and in the project name field, I put First Java Program and after I wrote the Java application, when I save it, I put GetStarted.java in the save as field. Is this okay? And how do I compile my Java application from here?
 
Physics news on Phys.org
No, not necessarily.

You have a class named GetStarted in the file GetStarted.java, right? If it is your only class and there is a main method within that class you can compile it by just pressing the green button that has the shape of a triangle. In your case Netbeans will configure the compiler to compile said file (GetStarted.java). If you have more than one class with a main method, Netbeans will ask you which one you want to compile.
 
Thank you for the help. I did as you said and got
run:
BUILD SUCCESSFUL (total time: 0 seconds)
in the output window in my IDE. So did I did this right?
 
Yes, you did it right. ;)

However, if there was some code that printed text on the screen on the main method within GetStarted.java you should have seen that too.
 
So in order to run (execute) a Java application, just press the green button that looks like a triangle and you're done, right?