Setup Eclipse on Endeavour OS

Installing eclipse IDE via terminal

Run sudo pacman -S eclipse-java on terminal.

source: https://wiki.archlinux.org/title/eclipse

Creating a project

  • Open eclipse IDE, eclipse launcher window appears.

  • Select the path where you want to create your projects. For me, the default path seems ok. Click on Launch.

  • eclipse workspace window appears, Click on create a java project as shown in the picture below.

  • A new window appears, enter the project name for example: Student. Uncheck the module-info.java file because here we are creating a simple java project and we don’t need any modules for that.

  • Click on finish

  • Now the project has been created, you can see your project directory under Package Explorer in the picture belorw.

  • Lets create a java class. Click on File -> New -> select Class

  • Enter the class name(for example: StudentClass) and check the button to allow boilerplate code public static void main(String90 aregs) function. Click on Finish.

  • Java class is created successfully, now lets display a simple greeting message for our fellow java programmars by typing System.out.println("Hello World!") inside main fn.

  • Save the file and run it.

  • Here’s the output

JAVA Package management

Creating multiple classes inside Package

  • Lets say you want to create more than one class that are used in a single project, these classes are desgined to perform a specfic function of a project when group of one or more than one classes are created to perform a similar function, then we group them together inside Packages.

  • Packaging in software engineering is one of the core process for development of any software product.

  • For example: here the student class prints Hello world and we want to create another class that prints the Student courses.

  • As both of them are related to Students so we will group them together inside a single package which will be called a STUDENT.pkg.

Creating Java packages

  • Right click the Student folder and go to New -> Package.

  • Give it a package name(For example: STUDENT.pkg), click on FInish

  • Again, right click the STUDENT.pkg package and go to New -> Class. Create a class called StudentClass by following the steps mentioned above.

  • Similary, create another class called Student.java.

  • Now these two classes are a part of a single package as you can see a new line is being added on top of each of these files.