Should the project name of my Java application ?

Click For Summary

Discussion Overview

The discussion revolves around the naming conventions for a Java application project in Netbeans IDE, specifically whether the project name must match the filename when saving the application. It also touches on how to compile and run the Java application within the IDE.

Discussion Character

  • Homework-related
  • Technical explanation

Main Points Raised

  • One participant questions if the project name must match the filename when saving the Java application.
  • Another participant clarifies that the project name and the filename do not need to be the same, as long as the class name matches the filename.
  • A participant confirms successful compilation of the application and inquires if the process was done correctly.
  • Another participant reassures that the compilation was successful but notes that output from the main method should also be visible if present.
  • A participant seeks confirmation that pressing the green button in the IDE is sufficient to run the application.

Areas of Agreement / Disagreement

Participants generally agree that the project name does not need to match the filename, but there is some uncertainty regarding the visibility of output from the application when run.

Contextual Notes

There may be assumptions about the presence of a main method in the Java class and the expected output behavior that are not fully explored.

Who May Find This Useful

Individuals learning Java programming, particularly those using Netbeans IDE for development.

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?
 
Technology 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?
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
7K
Replies
8
Views
3K
  • · Replies 25 ·
Replies
25
Views
3K
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
7K
Replies
3
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
11
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K