IDE:Eclipse – development environment for Raspberry Pi

Before we dive into what is an IDE, it is important to note that there are a variety of development environments available for the Raspberry Pi. We will not be covering more than a couple of them because so much goes into picking a development environment. Many of the tools that are available are specific to a programming language are good for that language but are not very good with other languages.

An IDE, or Integrated Development Environment, is a software application that combines various tools for software development into a single program. IDEs help programmers be more productive by making it easier to edit, build, test, and package software code.

It is important to note that building a program can be done with a simple editor, a compiler, and simple test procedures. In theory, and IDE will help with all phases of this development. Given the large number of tools available on the Raspberry Pi, we will focus on two which are generic and “mainstream” for professional programmers (Eclipse and Microsoft Studio) and work with Python, C/C++, and Java. In this posting we will focus on Eclipse getting it to work with all three languages.

Eclipse (https://www.eclipse.org/) is an integrated development environment (IDE) used in computer programming. It contains a base workspace and an extensible plug-in system for customizing the environment. The Eclipse Foundation helps develop and distribute the code as free and publicly available.

Unfortunately, you can’t use apt-get to install the eclipse IDE. To install the software package you need to download the software then execute an installer. The software can be downloaded from https://www.eclipse.org/downloads/packages/ using the Linux AArch64 framework.

From a VNC or console connection into your Raspberry PI, launch a web browser and download the code

Once the tar.gz file is downloaded it can be extracted so that we can execute the installer.

The eclipse-installer/eclipse-inst can be executed to begin the installation.

Executing the eclipse-inst gives us the option of what development language to install initially. We will choose the C/C++ environment.

Launching the IDE brings up the development environment. From here we can create our hello world example as we did from the command line.

We can create a new C/C++ project

With an IDE we have other options available to us. A Makefile, for example, allows us to automate building our binary from one or multiple source files. From the New project we select Make and Makefile Project then Next.

We name the project and select create sample code and sample Makefile.

When we click Finish we get two new files created, HelloWorld.cpp and Makefile.

Some differences from the code generated are the use of iostream rathern than stdout.h and using the “<<” rather than printf(). In this exampke, argc and argv are included in the main() function definition to accept input parameters from the command line.

For our example we will change the iostream and way we print to the standard way using printf(). Selecting Project -> Build All allows us to build the binary.

Running the Build All will compile the HelloWorld.cpp file and show any problems or errors in the code. If we jump out of the development environment we note that there is a build folder that contains the compiled cod and runnable binary.

We can run the binary from the IDE and see the output in the console.

Note that we can run or single-step into the code the see what each instruction performs. You can also set breakpoints to stop when you get to a specific place to look at things like variables or parameters that exist or are passed into a specific point in the code. An IDE makes this happen very easily and significantly helps with debugging.

Now that we have a stable C/C++ development environment we can do the same for Java by going to the Install Software and searching for Java.

Clicking Next downloads a JDK and the Java development environment. The IDE needs to be restarted to provide the new environment.

To create a Java project, Create New Project.

From there, select Java Project.

Enter a name and click Next

Now that we have a project, we need to create a Java class that will contain our main() function. File -> New -> Class.

We define the java class HelloWorldJ and check create a main routine.

We add the System.out.printf() line to print our comment.

We can then select Run or Debug as a Java class file. If we set breakpoints as discussed before we can look at variables and runtime conditions at specific points in our code.

Note that the output appears in the console at the bottom of the IDE.

Python is installed and configured similarly. We go to Help -> Marketplace and search for Python.

Click on Install and restart the IDE. To create a Python project, click on New Project and select PyDev Project.

Before the first creation you must configure the interpreter and support libraries.

Clicking on the configure an interpreter allows us to select the Python 3 default installed on the operating system.

Select Choose from list and the IDE will look at all Python binaries on the system.

We will select the python3 in the default /usr/bin directory.

along with the 3.11 support libraries.

I had to resize the popup screen to get to the Finish button at the bottom. This creates the Python project.

We create a new PyDev module and add the print option to the file created.

Now that we have the code available we can run it as a Python binary.

At this point we have an IDE on the Raspberry Pi that can develop C/C++, Java, and Python code. The IDE allows us to develop, debug, and compile all of these languages. We barely covered the surface of what you can do with an IDE but will look at more features in future posts.