Module 1: Getting Started with Java
Lesson focusSetting Up Your Professional Development Environment (IDE)
A comprehensive guide to installing the JDK and setting up a professional Integrated Development Environment (IDE). We will cover IntelliJ IDEA, Visual Studio Code, and Eclipse.
Choosing Your IDE: An Integrated Development Environment (IDE) is a powerful tool that makes writing, compiling, running, and debugging code much easier. For Java, the three most popular choices are IntelliJ IDEA, Eclipse, and Visual Studio Code with extensions.
- IntelliJ IDEA (Community Edition): Highly recommended for beginners and professionals alike. It has excellent code completion, refactoring tools, and a user-friendly interface. We will use this as our primary example.
- Eclipse: A long-standing, powerful, and open-source IDE. It is highly extensible with plugins but can sometimes feel less intuitive than IntelliJ.
- Visual Studio Code (VS Code): A lightweight and fast code editor that can be turned into a powerful Java IDE with the right extensions (like the 'Extension Pack for Java' from Microsoft).
Step 1: Install the JDK: Before installing an IDE, you must have a JDK on your system. We recommend the latest Long-Term Support (LTS) version (e.g., JDK 21). You can download it from Oracle, or use an open-source distribution like Eclipse Temurin or Amazon Corretto.
Step 2: Installing IntelliJ IDEA Community Edition:
- Go to the JetBrains website and download the free Community Edition.
- Run the installer and follow the on-screen instructions.
- On first launch, you can customize your theme and settings.
Step 3: Creating Your First Project in IntelliJ:
- Click on 'New Project'.
- Give your project a name (e.g., 'Java-Course-Projects').
- Select 'Java' as the language.
- For the JDK, IntelliJ should automatically detect your installed JDK. If not, click 'Add JDK...' and navigate to the directory where you installed it.
- Check the box 'Add sample code' to generate a simple
Mainclass.
- Click 'Create'. IntelliJ will set up the project structure, including a
srcfolder for your source code.
Mini-Exercise: Install the JDK and IntelliJ IDEA on your computer. Create a new project and run the sample main method to ensure everything is working correctly.
// The code generated by IntelliJ IDEA
public class Main {
public static void main(String[] args) {
System.out.println("Hello and welcome!");
for (int i = 1; i <= 5; i++) {
System.out.println("i = " + i);
}
}
}Lesson quiz