Today we shall see how to create Java Itegrated Development Environment (IDE) on your PC and write, test & run your Programs in simple steps.

Carefully read following steps and work accordingly for most easy, smooth and perfect work.

Installing Java IDE on your PC/Laptop

With Java IDE you will be able to write your own programs in Java and Run them for studying and testing.

  1. First visit this link (https://www.oracle.com/in/java/technologies/javase-jdk15-downloads.html), scroll down at the bottom of the page and then click on Windows x64 Installer, 159.71 MB, jdk-15.0.2_windows-x64_bin.exe and download JDK on your computer. Then install it.
  2. After that download Eclipse IDE from this link (https://www.eclipse.org/downloads/) and install it.
  3. After completing above two steps, restart your computer.
  4. Click on the shortcut icon of Eclipse on the desktop to start the Eclipse IDE on your PC.

Create Workspace

  1. First of all go to desktop or any other location on your computer and right click to create a new folder.
  2. Give a name ‘My Java Programs’ to this folder which will serve as your workspace for your studying and testing programs in Eclipse IDE.
  3. Now open Eclipse IDE by double clicking on desktop shortcut icon.
  4. Click on Menu > Switch Workspace > Other.
  5. This will open a dialog box – Eclipse IDE Launcher.
  6. Click on ‘Browse’ button and browse your workspace folder ‘My Java Programs’ location and select it.
  7. Then click ‘Launch’ on Eclipse IDE Launcher Dialog box.
  8. This will complete first step of creating workspace to write, test and run your programs.
  9. All the data of your programs will be stored in this workspace.

Create your First Java Project

  1. Open Eclipse IDE again (if closed) by double clicking on desktop shortcut icon.
  2. Click on Menu > Files > Java Project
  3. The ‘Create a Java Project’ dialog box will appear.
  4. Type a name of the project in ‘Project Name’ field as ‘TestPrograms’ and press enter.
  5. Another dialog box of ‘New Module-Info.java’ will open.
  6. Click the ‘Don’t Create’ button at the bottom.
  7. This will complete step-2 and now you are ready for creating the classes in Java IDE.

Create Classes

  1. Open Eclipse IDE again (if closed) by double clicking on desktop shortcut icon.
  2. Click on Menu > Files > New > Class
  3. The ‘New Java Class’ dialog box will appear.
  4. Write a name of the class in ‘Name’ field and then press enter to create class.

Now Start Writing your Programs

  1. Now open a class by double clicking on the list of classes in ‘Package Folder’ section, on the left.
  2. This will open the class in a tab at the middle workspace of Eclipse IDE.
  3. After that start typing your programs in this workspace under respective class tab.

Tested Practice Programs of Java

Once you setup your Eclipse installation and Java IDE on your computer, you will be curious to practice different programs using Java.

For that try the following lab tested programs of Java.

Remember you have to create exactly the classes given at the beginning of each of the following programs. However, you can change the name of the classess in the programs as per your choice also.

Welcome to Java

class Welcome {  
    public static void main(String args[])
{  
     System.out.println("Welcome to Java!");  
    }  
}

Addition of two numbers

class Addition
{  
   public static void main(String[] args) // the method
  {  
   int a=10; // first variable declared
   int b=30; // first variable declared
   int c=a+b; // first variable declared
   System.out.println(c); // print the output
  }
}

Incrementing Variable Value

class Increment 
{
    public static void main(String[] args)
    {
        int a = 5; 
        int b = ++a; // the operator appears before the operand
        System.out.println(b);
        System.out.println(a);
    }
}

Decrementing Variable Value

class Decrement {
    public static void main(String[] args)
    {
        int a = 5; 
        int b = a++; // the operator appears after the operand
        System.out.println(b);
        System.out.println(a);
    }
}

How to get user input in a program?

import java.util.Scanner;
public class MyClass {
  public static void main(String[] args) {
   Scanner readme = new Scanner(System.in);
   System.out.println("Enter two numbers & press enter each time:");
   
   //two variables to hold numbers
   int a, b, c;
   a = readme.nextInt();
   b = readme.nextInt();
   c = a + b;
   System.out.println("Total = " + c);
  }
}

If you liked this post, please comment below.

Leave a Reply