TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

Eclipse Tutorials

Create Java Package in Eclipse IDE

Overview

This article demonstrates the steps involved to Create Java Package in Eclipse IDE. Eclipse IDE should be installed on the machine.

Environment

We use the below environment in this tutorial:

  • Windows 10 Operating System
  • Eclipse IDE
  • JDK

What is a Package?

A Java Package groups and bundles related Java types like classes, interfaces, annotations, etc. Packages provide control access and avoid naming conflicts. Developers can group related types into a package so that it would be easy to find and use them in Java code.

The Java platform itself has many packages. These packages group and bundle classes, interfaces, and other types. For Example, all the fundamental classes, interfaces are in the default java.lang package.

Create Java Package

Create a Java Project. Steps to create a new Java project are outlined here:

Create New Java Project in Eclipse

Select the Project in the Project Explorer.

Choose File >> New >> Package menu option to create a new Java package.

Alternatively, Right-click on the project choose New >> Package from the context menu.

Give a package name and click on the Finish button.

Create New Java Package Eclipse IDE

 

We can also create a package-info.java. Check the checkbox option Create package-info.java on the Create new Java Package window.

A package-info.java file is a home for package-level documentation. It is a way to apply Java annotations at the Java package level.

Package names are defined with all lowercase to avoid conflict with the names of classes or interfaces.

Organizations use reversed Internet domain names to define the package names for their Java projects. For example, com.testingdocs.sample for a package named sample.

A class named HelloWorld is defined in the com.testingdocs.sample package, the fully qualified name of the class would be com.testingdocs.sample.HelloWorld

That’s it. We have created a new Java package inside a Java project using Eclipse IDE. We can create related classes, interfaces, etc in packages.

To create a New Java Class: New Java Class in Eclipse IDE

—

Eclipse Tutorials

Eclipse Tutorials on this website can be found at:

https://www.testingdocs.com/eclipse-tutorials

For more details on the Eclipse IDE, visit the official website

https://www.eclipse.org

Related Posts

Download Eclipse Installer

Eclipse Tutorials /

Install Eclipse using Installer on Windows 10

Eclipse Tutorials /

Eclipse Che Overview

Add Eclipse SpotBugs Install URL

Eclipse Tutorials /

Install SpotBugs Eclipse Plugin

Eclipse File Import

Eclipse Tutorials /

Import Maven Project in Eclipse

Eclipse marketplace online catalog

Eclipse Tutorials /

Eclipse Marketplace

‹ Create a New Java Project in Eclipse› Eclipse IDE Memory Settings

Recent Posts

  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows
  • Activate CLion IDE
  • CLion IDE for C/C++ Development

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version