Java Installation and Environment Setup

Java Installation and Environment Setup, Download & Install Java JDK software, set Java Environment variable, and Install Eclipse IDE.

Java Programming Environment, Java Language Elements, and Java Object-Oriented Programming.

Java Programming Environment

Java supports various operating environments like MS Windows, Linux, Macintosh, etc, to write & execute Programs.

To write and execute Java programs then Java Environment is required

Three important steps in Computer programming,

  1. Write a Program (in an Editor)
  2. Compile the Program
  3. Run the program
I. Steps for writing and executing Java programs using the command-line interface
  1. Download Java Software (JDK) and Install
  2. Set Java Environment variable in the OS Environment
  3. Write a Java program in Notepad and save it with the “.java” extension
  4. Compile the java program file in command prompt and Run…
II. Steps for writing and executing Java programs using Eclipse IDE
  1. Download Java Software (JDK) and Install
  2. Set Java Environment variable in the OS Environment
  3. Download Eclipse IDE and Extract
  4. Write Java programs in Eclipse Editor and Run

I. Java Programming using the command-line interface

1. Download Java Software (JDK) and Install

Download Java Software (JDK) from either java.com or oracle.com, and install

Note: Download Java Software based on your Operating Environment
Example: Windows 10 64 bit OS

After Java Software installation we get the “Java” Folder in C:/Program Files/

2. Set Java Environment variable in the OS Environment

Navigation to set Java Environment Variable

First, copy the JDK bin directory path from your computer,
Select MyComuter and Right Click,
Properties
Click “Advanced System Settings”
Click “Environment Variables
Select “Path” Variable in the System Variables pane
Click “Edit”
Paste Jdk bin directory path
Click “OK”
Click “OK”
Click “OK”

3. Write a Java program in Notepad and save with “.java” extension

public class Sample{

public static void main (String [] args){
System.out.println(“Hello Java”);
}
}

save as .java file with class name


4. Compile the java program file in command prompt and Run…

Compile the Program

Launch the Command prompt
Change to Java program file directory
Type javac File Name/sample.java

Then it will create a Java class file (.class)

Run the program

Launch the Command prompt
Change to Java program file directory
Type Java Class file name without extension

It will display the output on the Console

II. Java Programming using the Eclipse IDE

Steps:

Download Eclipse IDE & Extract the Software,
Download Java (JDK) and Install (as like above, we already mentioned),
Set Java Environment Variable Path (as like above, we already mentioned),
Launch Eclipse IDE, Write Java Program, and Execute the Program

Eclipse IDE:

Eclipse IDE is a platform to write & execute Computer programs like Java, C, C++, Perl, Python, Ruby, PHP, etc…
Eclipse IDE is Open Source, it provides an Editor for writing Programs, Syntax Guidance, Context Help, and Auto compilation, etc…

Navigation for writing and executing Java programs in Eclipse IDE

Launch Eclipse IDE
Create Java project
Create Java Package under the Java Project
Create Java Class under the Java Package
Write Java code in the Java Class…

Java Program Example:

public class Sample {
public static void main(String[] args) {
int a=10, b=20;
System.out.println(“Addition of a, b is: “+ (a+b));
if (a>b){
System.out.println(“A is a Big Number”);
}
else {
System.out.println(“B is a Big Number”);
}
}
}

Java Installation and Java Environment Setup


Java Programming Language Syllabus

Java Step by Step Videos

Follow me on social media: