3.CONTINUE PROGRAMMING JOURNEY WITH IDE
Can you see how beautiful Java is?
A computer understands only 0s and 1s. Yet, using a high-level programming language.
like Java, we can describe real-world concepts such as objects, convert them into
instructions, and solve complex problems with the help of a computer.
Now, we will continue our journey of Java programming using an IDE.
What is an IDE?
IDE stands for Integrated Development Environment.
An IDE is specialized software that helps programmers write, organize, compile, debug,
and manage programs much more efficiently, especially large and complex ones.
Previously, you wrote Java programs using Notepad. However, Notepad is simply a text
editor. It cannot:
- Detect syntax errors while you type.
- Format your code automatically.
- Help you complete code.
- Compile your programs.
- Provide debugging tools.
Advantages of Using an IDE
- Syntax Highlighting
Different components of a program are displayed using different colors and font styles. - Code Completion
The IDE predicts what you are likely to type and suggests possible completions. - Refactoring Support
Rename variables or other identifiers throughout the project automatically. - Integration with Code Repositories
Connect to shared repositories used by development teams. - Debugging Support
Find and fix program errors efficiently. - Code Search
Quickly search for variables, methods, classes, or text. - Automatic Code Generation
Generate boilerplate code and simplify repetitive tasks.
Popular Java IDEs
- IntelliJ IDEA
- Eclipse
- NetBeans
- BlueJ
- JCreator
- JDeveloper
- Android Studio
- Xcode
Note: Software is a collection of programs executed by the CPU to perform specific
tasks. Even the operating system is software.
Note: A set of instructions written in any high-level or low-level programming language
is called code or a program.
Installing Eclipse for Java
Ensure your computer is running.
Search for Eclipse from the Start menu or desktop.
If it is not installed: open a browser, search for ‘Eclipse for Java download’, download
the correct version, install it, and launch Eclipse.
Creating Your First Java Project
Create a new Java project by selecting File → New → Java Project, enter a project name
such as MyFirstProject, and click Finish.
Analogy 3.1 - You can think of a movie movie going to be made, as a project. So, all the activities that will happen related to that movie production will be tagged against that movie name. E.g. movie going to be made is “Border”. Then we will say “Border” film is being shot in Kashmir. This scene of “Border” film is shot in Ooty. Few major politicians are coming in “Border”.
- Similarly, all the programs will be written under a root called project.
- Go to File > New > Java Project
- Give a name to the project – say “MyFirstProject”
- IDE will create an empty project for you. You can now write all programs within it. Have a look at the structure of the project got created. It is called tree structure.

Understanding Packages
Another important concept in Java is the Package.
A package groups logically related Java classes and files together, making projects
easier to organize and manage.
There is no fixed rule for deciding which classes belong in a package. A package may
contain any number of Java files.
Analogy 3.2
School Sections: Imagine a school admitting 200 students into Class VI. The students
are divided into Sections A, B, C, and D on a first-come, first-served basis. These
sections are similar to Java packages because they group related members together.
University Example: A university admits 900 B.Tech. students and groups them by
branch (CS, EC, ME, CH). Each branch is further divided into batches such as A, B, C,
and D. Likewise, every Java class belongs to a specific package.
Creating a Package
Create one or more packages in your Java project to organize your classes.
Open File Explorer after creating a package. Notice that every Java package is
represented as a folder on your computer.
Activity – Do It Yourself
Create a new Java Project in Eclipse. Create a package and place the following classes
inside it:
- Car.java
- TestCar.java
[IMAGE: FOLDER TREE STRUCTURE DIAGRAM]
Running a Java Program in Eclipse IDE
Earlier, using Notepad, you performed two steps: compile the program and then
execute it.
Step 1: Compile the Program
javac FileName.java
Step 2: Execute the Program
java ClassName
Automatic Compilation in Eclipse
Enable Project → Build Automatically. Eclipse will automatically compile your .java files
whenever you save them.
Viewing the Project Folder
Select the project, press Alt + Enter, note the project path, and open it in File Explorer
to view the source and compiled files.
Observe Automatic Compilation
Modify a Java file, save it, and observe that the corresponding .class file’s modified
date changes automatically.
Now, only step remaining for us to do is step-2. Now that you need not to issue command (java ). You need to use mouse more often than keyboard. - Go to TestCar.java anywhere on the option. Right click on .java file & select Run As > Java Application.
- OR Option 2: Click on Run from the top menu bar & select Run As > Java Application.
- The CPU will get your instruction to execute the instruction in your .java files.
- You should be able to see the output on IDE’s console. Output means what we read in initial chapter. What is the data/information computer will show/reach via output device is output.