Open In App

Creating Java Project Without Maven in Apache NetBeans (11 and Higher)

Improve
Improve
Like Article
Like
Save
Share
Report

In this article, you will find the steps to create a simple Java Project without Maven in Apache NetBeans (v 11 and higher). Since maven has launched, the creation of Java Project directly has been shifted under the “Java with Ant”, due to which the geeks who upgrade themselves to the new Apache NetBeans face problem finding the option to create a simple Java Project i.e. without maven.

The description says :- In Java Application of Java with Ant you are 
Creating a new Java SE application in a standard IDE project. You can also generate a main class in the project. Standard projects use an IDE-generated Ant build script to build, run, and debug your project.

Follow the steps provided below to achieve the same:

Step 1: Creating your simple Java Project
    Step 1.1 – Right-click on the File option in the navigation bar.
    Step 1.2 – Click on the Create new project. (Shortcut key for the same is – Ctrl+Shift+N)
    Step 1.3 – Under categories choose Java with Ant.
    Step 1.4 – Under Projects choose Java Application.
    Step 1.5 – Click Next.
    Step 1.6 – Provide the package name such as “com.packagename”(this is the standard to write a package name).
    Step 1.7 – Only check the checkbox of Create main class if you want a default class containing the main() function in your project.
    Step 1.8Finish.

 

After clicking on Finish, your project will be created.

Step 2: To create a java package inside a project.

Creating classes in the default package provided by the IDE is not said to be a good practice. Thus, it is generally advised to create your own package. 

A package generally has a name like “com.mypackage”, it is because in practice the package name is kept as the reverse of the company domain. For example :- If a company has a domain of “historyclass.com” then the package name will be like “com.historyclass” and following sub-topics such as world history, Indian history, etc.

     Step 2.1 – Expand your created project and left-click on Source Packages.
     Step 2.2 – Click on New.
     Step 2.3 – Choose the Java Package.
     Step 2.4 – Provide the name of the package such as “com.packagename”.
     Step 2.5 – Click on Finish.

The package will be created under the Source Packages.

Step 3: To create a Java Class in any package.

     Step 3.1 – Left-click on the package in which you want to create the java class.
     Step 3.2 – Click on New.     
     Step 3.3 – Choose the Java Class.     
     Step 3.4 – Provide the name of the class such as “MyClass”.     
     Step 3.5 – Click on Finish.

 

     

By now, we have successfully created a Java Project, Java Package and Java Class.


Last Updated : 03 Mar, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads