Maker.io main logo

How to Use Alternative Programming Languages In Eclipse

2018-06-13 | By Maker.io Staff

Eclipse is one of the most popular IDEs for coding in Java, but, as it turns out, it can be used for different languages, including C, C++, and even Python! In this how-to article, we will learn how to get Python up and running in Eclipse with the help of the Eclipse Marketplace!

Things You Will Need

  • Eclipse Oxygen with C/C++
  • Python 3 already installed

Installing Python

The installation of Eclipse will not be covered in this how-to, since that was already covered in a previous article. Instead, we will start with the Eclipse welcome page. In the bottom left area, select “Launch the Eclipse Marketplace”, and a window should appear.

How to Use Alternative Programming Languages In Eclipse

In the window that appears, enter “Python” in the “Find” search box and click the magnifying glass icon.

How to Use Alternative Programming Languages In Eclipse

From the list that appears, click the “Install” button next to PyDev.

How to Use Alternative Programming Languages In Eclipse

During the installation, you will be asked to confirm selected features. At this point, just click “Confirm”.

How to Use Alternative Programming Languages In Eclipse

The last stage asks you to agree to the license terms, which no one ever reads, so go ahead and click “Finish”.

How to Use Alternative Programming Languages In Eclipse

Be careful not to close Eclipse at this time, since it will install PyDev in the background. Wait for the following window to appear and then click “Restart Now”.

How to Use Alternative Programming Languages In Eclipse

Creating a Python Project

When the IDE loads, click File > New > Project, and, in the window that appears, select “PyDev Project”.

How to Use Alternative Programming Languages In Eclipse

How to Use Alternative Programming Languages In Eclipse

Before going further, it’s imperative that Python3 has already been installed and added to the environmental variables!

The next windows asks for several things, including the project name, the project type, the interpreter, and other odd variables. For now, our project will be called “PythonProject”, we will select “Python” as the project type, and we will leave the grammar version as is, as well as the radio button options at the bottom.

However, we need to configure an interpreter before we can go further. To do that, click “Please configure an interpreter before proceeding”.

How to Use Alternative Programming Languages In Eclipse

In the window that appears, click “Quick Auto-Config”, as this should work in most cases. This may take a while, but once completed, the window should look similar to the one shown below.

How to Use Alternative Programming Languages In Eclipse

The next window may ask you about perspectives. At this point, check “Remember my decision” and then “Open Perspective”.

How to Use Alternative Programming Languages In Eclipse

Testing Our Project

Now that we have Python working in the Eclipse IDE, it's time to create a simple Python program to confirm that it is working. Start by pressing Ctrl + N, and, in the window that appears, select General > File.

How to Use Alternative Programming Languages In Eclipse

In the next window, ensure that “PythonProject” is selected and then, in the file name box on the bottom, type “main.py”. This will be our main python file that runs when we create python programs. When you click “Finish”, you may see the window below; if so, simply click “OK”.

How to Use Alternative Programming Languages In Eclipse

In the main file that loads, enter the following command.

print("hello")

Save the file and then run the program by clicking the green arrow in the toolbar shown below.

How to Use Alternative Programming Languages In Eclipse

If all goes to plan, when the code executes, you should see the following in the console output.

How to Use Alternative Programming Languages In Eclipse

TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum