Step by Step Guidelines to Install Java, Set Path and Run First Java Program

ADMEC Multimedia Institute > Web Development > Step by Step Guidelines to Install Java, Set Path and Run First Java Program

If you start to learn Java program as a beginner and wish to learn Java training institute then below mentioned points are important for you. With this guide to install Java from the renowned Java , you will learn fundamental concepts and steps which are necessary for every Java beginner:

  1. How to install Java in your system
  2. How to set path in your system to run your first Java program
  3. How to write first Java program
  4. How to run your first program in Command Prompt after saving your program in desktop
  5. How to run your first program in Command Prompt after saving your program in another drive

Before you go with this guide to install Java, here’s a quick overview to Java.

Basic Introduction of Java Installation

JAVA codes runs on a rule of WORA i.e. Write Once, Run Anywhere. It means that the code can be complied on any platform be it Windows, Linux or MAC. No recompilation of code is required.

You will be surprised to know that its code is similar to that of C and C++. It is a robust, versatile as well as secure coding language.

  • It is far easy, object oriented as well as familiar language to those who are already working on C or C++.
  • It is interpretable language which is dynamic as well as use threads.
  • At the end it produce light weight as well as high performance results.

Important things to consider before installing JAVA

Before installing java here are the few things you need to know :

  1. There are so many applications as well as websites that work only when you have installed in your system.
  2. It is open source as well as free of cost
  3. You should know that configuration of your system such as whether it is Windows 64X or 32X or what. On the basis of this only you will be able to select your software.
  4. When you will install java, then you will have JRE i.e., Java Runtime Environment and this contains JVM i.e., Java Virtual Machine.
  5. JRE is the only one which allows the uninterrupted functioning of  the java applications on your browser.

Downloading and Installation of Java:

To run Java, first of all you have to install software called Java SE development kit(or JDK).

JDK contains:

  • JRE(Java Runtime Environment):JRE is main of Java platform which create environment to run Java programs on your computer. It includes JVM (Java Virtual Machine) which runs Java programs by converting source code to bytecode to platform-dependent code. and executes the program.
  • Libraries and tools that support Java development

You can download latest Java version after clicking below mentioned link: https://www.oracle.com/java/technologies/downloads/

After clicking above link you have to “accept license agreement” and choose latest version, according to your system configurations.

After downloading the software, run it to install JDK and follow steps:

After Successfully installation of Java you can see directory like: C:\Program Files\Java\jdk1.8.0_73

How to check wheter Java installation was successful or not:

  • For this open command prompt (using Window+ R)
  • And type there Java -version(as shown in fig below)

It shows version of the JRE, ex; 1.8.0_73… Congratulations!!!

Now you are able to run Java first program

Set path in your system to run first Java program:

1. Go to window and choose computer:

2. After selecting computer click right side button of your mouse and Click on properties:

3. Then Click advanced system settings:

4. Select advanced option on top and click on environment variable button as shown in fig:

5. After clicking on environment variable button a pop up will be open where you have to click on new button as shown in below fig where :

6. After click on new button a pop appear where you have to fill:

Variable name: Path

Variable Value: C:\Program Files\Java\jdk1.8.0_73\bin

  7. After inserting variable name and variable value click three times OK OK OK….

Java First Program

  1. You can write java program using notepad, notepad++ or netbeans etc.
  2. After writing program you must have save the file (either on desktop or drive )with class name, which you have written in program:

EXAMPLE:

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

Program Output:

Hello ADMEC

      3. Save above program as hello.java

Steps to run program after saving on desktop:

      4. Open cmd(Window+R)

      5. Write cd desktop   

    6. For compilation of program write javac hello.java

  • when your program compile successefully, another file is generated on your desktop and i.e will class file.

      7. For Output:

  • write java hello , now it’s ready to run yor first java program and output of above program will be Hello ADMEC

Steps to run program after saving program in D or E drive:

  1. Create a folder either in D drive or E drive (Ex: Java Program)

Ex:

Computer-> Local Disk(D:)-> Java Program

  1. Write program
  2. Save the program under Java Program
  3. Open cmd(Window+R)
  • Write first: D:
  • cd Java Program
  1. For compilation of program write javac hello.java
  2. For Output:
  3. write java hello , now it’s ready to run your first java program and output of above program will be Hello ADMEC

Conclusion:

Are you excited to learn more about the java? Then join the best java training course at the best Java training institute in Delhi, i.e., ADMEC Multimedia Institute. Here, you will be guided by the professionals. They are all industry expert trainers.

Also, you will get thorough with all the concepts as they will provide you all number of assignments to work with. For any further information feel free to contact on 9811818122 and 9911782350.

Please leave your feedbacks or doubts in comments below if any.

Related Posts

Leave a Reply

Call Now