Get Started with Eclipse and Ubuntu #techtarget |Video upload date:  · Duration: PT4M25S  · Language: EN

Quick tutorial to install Eclipse on Ubuntu and create a Java project with setup tips and common fixes

If you want to stop staring at a blank terminal and actually ship Java code on Ubuntu then this short guide will get Eclipse up and running without ritual sacrifice. It covers installing OpenJDK, getting Eclipse on your machine, configuring the workspace, creating a project and running a simple program. No hand waving, a little sarcasm, and enough accuracy to keep your build green.

Install OpenJDK

Eclipse needs a JDK to compile and run code. Use OpenJDK 11 or newer unless your project insists on time travel. Update apt and install the JDK with the usual commands.

sudo apt update && sudo apt install openjdk-11-jdk
java -version

The java -version command confirms the runtime. If Eclipse later claims it cannot find Java then point it to the same JDK you just installed.

Install Eclipse

Two practical options exist. Use snap for a fast, low fuss install. Use the tarball when you want control over where plugins live and enjoy manual labor.

  • Quick install using snap
sudo snap install eclipse --classic
  • Manual install from the Eclipse download site

Download the package, extract it and run the eclipse executable from the folder. Snap will handle dependencies like an overcaffeinated babysitter. The tarball gives you the power to break things elegantly.

Configure workspace and Installed JREs

Launch Eclipse and pick a workspace folder. This is where your projects live. If you are indecisive you can create multiple workspaces and regret it later.

In the Eclipse Preferences navigate to Java then Installed JREs and add the path to your JDK if it is not already listed. You can also set workspace code style and configure language support or plugins for your workflow.

Create a Java project

Create a new project from the menu with File then New and choose Java Project. The wizard will help you set the project name and JDK level. Add a package and then a class with a main method. Example minimal class below will make your console happy.

package com.example;

public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, world");
  }
}

If you need external jars use the project Build Path to add libraries or use Maven or Gradle for dependency management and less manual pain.

Run and debug

Right click the class and choose Run As Java Application or hit the green play button. Check the Console view for output and any compiler messages. If the program misbehaves switch to the Debug perspective, set breakpoints and step through code like a digital detective.

Tips and troubleshooting

  • Use snap for speed and convenience. Use the tarball when you want fine grained control over installation folders and plugins.
  • Match the OpenJDK version to your project requirements. Using the wrong Java version is the leading cause of mysterious failures and passive aggressive error messages.
  • If Eclipse cannot find the JDK verify your JAVA_HOME and the Installed JREs setting in Preferences. Typical path on Ubuntu looks like /usr/lib/jvm/java-11-openjdk-amd64 and you can set it with export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 in your shell profile.
  • For build tools use Maven or Gradle inside Eclipse or via the command line. They will save you time and increase your future self respect.

This guide walked you through installing OpenJDK, installing Eclipse, configuring a workspace, creating a Java project and running a simple program. You should be able to write, run and debug Java code on Ubuntu without mystical rituals. Now push some code and try not to break the build too often.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.