How to Setup & Install Eclipse IDE Project on MacOS?

Devstringx Technologies
5 min readMar 24, 2023

Download and Install Java on MacOS

Installation of Java Version On MacOS

  • Search for ‘Oracle Java Jdk’ and open the first link (Java SE Download).
  • Click on the (Java SE Download) link and redirect to Java Download Page.
  • Search the latest java version on the download page for which java version you want to Install.
  • Now I am Installing JDK 17 version -> Click on the ‘JDK Download’ button below the ‘Oracle JDK’
  • Choose ‘macOS Installer’ to Download Java SE Development Kit 17
  • Click on ‘jdk-17.0.1_oxs-x64_bin.dmg’ Download link and accept the oracle License Agreement and click on the Download button.
  • Once the file is downloaded then displayed one Package on the terminal (JDK 17.0.1.pkg)
  • Click on the JDK package file
  • Click on the continue button
  • Click on the Install button — one popup will appear to enter the mac operating system ‘user name and password’.
  • Click on Install Software.
  • Click on the close button once the ‘Installation done Successfully’.

Note: This works on Mac OS running on M1 Chip and the Intel processors

You can download the JDK with the given below link:

https://www.oracle.com/java/technologies/downloads/

Setup the Java Path On Mac

Once the JAVA installation has been completed, With the help of the below steps we setup the Java Path on the Mac

  • Find the java version:

java -version

  • Find the location where Java JDK is Installed:

/usr/libexec/java_home

  • Now, find the shell you are on:

echo $SHELL

  • Find out the current directory you are in ZSH:

pwd

  • Navigate to the HOME directory:

cd /Users/[your_username]

  • List all the files in your current directory:

ls -al

  • Configure JAVA_HOME path in zsh shell in MACOS:

touch ~/.zshenv

open ~/.zshenv

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home

cat ~/.zshenv

  • Configure JAVA_HOME path in bash shell in MACOS

touch ~/.bash_profile

open ~/.bash_profile

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home

cat ~/.bash_profile

Good to Read:- Parallel Execution In Selenium Using TestNG

Download the Eclipse IDE on MacOS

You can also follow these given below Steps to install eclipse:-

  • Search ‘Download Eclipse for Mac‘ on the search bar.
  • It will navigate you to the official Eclipse download site with download options.
  • Click on the ‘Get Eclipse Oxygen‘ Download link.
  • Click on ‘DOWNLOAD 64 BIT‘.
  • Once the download will complete, you will get the installer in a compressed file.
  • On unzipping the file, you will find an eclipse installer launcher. Double tap to open it.
  • You may get a prompt saying the installer downloads from the internet and that are you sure to open it with the ‘Cancel‘ and ‘Open’ buttons.
  • Click on the ‘Open‘ button.
  • The eclipse launcher will get start loading.
  • Click on ‘Eclipse IDE for Java Developers and start the installation process.
  • Select the installation folder/directory to install the eclipse and click on the ‘INSTALL‘ button.
  • Next, it will pop you software user agreement where you need to click on the ‘Accept Now button
  • Now the installation process will get a start and will take some time to complete it.
  • Once the process will get finished, a green ‘LAUNCH‘ button will get appears to start the eclipse.
  • A splash window of the eclipse will get appears with an indication of the eclipse launching
  • A workspace popup will get appears for confirming the workspace directory for the eclipse. In this location, your all eclipse work gets stored. You can also change it as per your choice. Click on the ‘Launch‘ button.
  • Once you will click on the ‘Launch‘ button, eclipse gets to start with the welcome screen.
  • It will open the Welcome screen as a first-time launch screen, click on the cross button next to the ‘Welcome‘ tab.

You can download Eclipse Id using given below link:

https://www.eclipse.org/downloads/packages/release/oxygen/r/eclipse-ide-java-ee-developers

Install TestNg Plugin in Eclipse on MacOS

You can also follow these given below Steps to install eclipse:

  • Open Eclipse, click on the ‘Help -> Eclipse Marketplace‘ option available on the top bar
  • An eclipse marketplace window will get pop up.
  • Enter ‘testNG‘ under the ‘Find:’ search text field and hit the ‘Go‘ button
  • Under the available plugin results section; the ‘TestNG for Eclipse‘ option will get listed.
  • Click on the ‘Install‘ button.
  • Once you will click on the ‘Install‘ button, it will show you the feature selection dialog box.
  • Select all features and then click on ‘Confirm.
  • Next agreement screen will appear; click on ‘I accept the terms ‘ and then click on the ‘Finish‘ button.
  • Now download process will gets start; you can see the progress under the right bottom corner progress bar. Click on it to view it (optional) or can wait.
  • Now a ‘Security Warning‘ popup will appears. Click on the ‘Install anyway‘ button.
  • Once the installation process will get finished. It will pop up with a ‘Restart Now button window in order to restart eclipse again.
  • Now create a testNG class and try to use the testNG library which we have installed through the plugin.
  • Create a class with the name ‘TestNgTest‘ and paste the below code as given below format-

public class TestNgTest {

@Test

public void testMethod() {

System.out.println(“testng method”);

}

}

  • Now mouse over on the ‘@Test‘ annotation in order to add the testNG library to your project.
  • It will pop up the ‘Add testNG library‘ option. Click on it in order to add the testNG library to your project. It’s a one-time process for a particular project.
  • Now testNG library has been added to the project thus, we can import the testNG ‘@Test‘ annotation. Again mouse over on the ‘@Test‘ annotation, then it will show you the option ‘Import Test ‘ then make sure it’s from the testNG library and click on it.
  • Now ‘@Test‘ annotation has been added. Now right-click on class and mouse over on the ‘Run As option, it will show you the ‘TestNG Test‘ option to execute the test.
  • Now the test will get executed and can view the console as a report.
  • Also, for every execution, testNG will generate results, you can refresh the project and search for the test-output folder and expand it. Search for ‘index.html’. file and double-click on it in order to open the report.

Good to Read:- TestNg Listeners and Types of Listeners in TestNG

Import Java Project in Eclipse on Mac

You can also follow these given below Steps to import java Project in eclipse:

  • Open the Eclipse.
  • Click on the File Menu.
  • Click on the Import button.
  • Expand General Folder.
  • Click on Existing Project in Workspace.
  • Click on the Next Button.
  • Click on the ‘Browse button’ of Select root directory.
  • Choose the Project in which the folder resides.
  • Select the checkbox of ‘Project’ under the Project sections.
  • Select the checkbox of ‘copy projects into workspace’ under the options section.
  • Click on the Finish button.
  • Now the Project added under Project Explorer.

If you’re looking to build a high-quality Java application, then it’s crucial to hire the right developers. Don’t wait any longer, Take action now and hire Java developers who can deliver the results you need.

Originally published at https://www.devstringx.com on March 24, 2023

--

--

Devstringx Technologies

Devstringx Technologies is highly recommended IT company for custom software development, mobile app development and automation testing services