Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Java Should the project name of my Java application ?

  1. Dec 26, 2014 #1
    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?
  2. jcsd
  3. Dec 27, 2014 #2
    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.
  4. Dec 27, 2014 #3
    Thank you for the help. I did as you said and got
    BUILD SUCCESSFUL (total time: 0 seconds)
    in the output window in my IDE. So did I did this right?
  5. Dec 27, 2014 #4
    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.
  6. Dec 28, 2014 #5
    So in order to run (execute) a Java application, just press the green button that looks like a triangle and you're done, right?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook