yt

Header Ads

Chapter 3 What is Java Compiler/ How to Setup/ Run 1st Program Explain in Details.

How to Install Java Compiler 

Java Compiler Install are two types:

Well you are write, The java program are two types source and compile.

  1. Java Software Development Kit (SDK)
  2. Java IDE such as NetBeans. 
In Hindi:- Java आप 2 तरह से इंस्टॉल कर सकते है। एक तो आप जावा command prompt version डाउनलोड कर सकते है। जिसमे सिर्फ आपको java प्लेटफार्म मिलता है और आप कोई भी editor यूज़ करके प्रोग्राम बना सकते है और command prompt से उस फाइल को रन करवा सकते है। दूसरा आप जावा का IDE डाउनलोड कर सकते है ये एक ऐसा environment होता है जिसमे आप प्रोग्राम बना कर वही से उसे रन करवा सकते है। जावा की official वेबसाइट पर आपको NetBeans IDE मिलेगा लेकिन आप Eclipse भी डाउनलोड कर सकते है।


Downloading Java JDK 
Note:- Always Install Latest Version.
Step1. 
  • Go to the official websites
  • Click here :- www.oracle.com
  • Select Windows Options.
  • https://download.oracle.com/java/18/latest/jdk-18_windows-x64_bin.zip (sha256 )
  • Click this type of link then finial Done.


There are two step to setup the environment in Java for Installing

1.Window 7

Step 1: Copy the JDK Path

  • Go to C Drive
  • click on Program Files(x86)/Program Files
  • click on java
  • click on jdk
  • click on bin
  • Now copy the url ,It looks like this
  • C:\Program Files (x86)\Java\jdk1.8.0_45\bin

Step 2: Setup the environment Variable

  • 1.From desktop, right click on Computer icon.
  • 2.Choose Properties
  • 3.Click the Advanced system settings
  • 4.Click Environment Variables
  • 5.In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  • 6.Now in next window there are two section Variable Name and Variable Value now in Variable Name put PATH and in Variable Value paste the copied URL in the Step 1 and add semicolon in the last then click ok.
  • Now open command prompt window and run java code.


2.Window 10

Step 1: Copy the JDK Path

  • Go to C Drive
  • click on Program Files(x86)/Program Files
  • click on java
  • click on jdk
  • click on bin
  • Now copy the url, It looks like this
  • C:\Program Files (x86)\Java\jdk1.8.0_45\bin
  • or 
  • C:\Program Files (x86)\Java\jdk1.8.0_45

Step 2: Setup the environment variable

  • 1.In Search, type control panel and open it.
  • 2.Choose System
  • 3.Click the Advanced system settings
  • 4.Click Environment Variables
  • 5.In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  • 6.Now in next window there are two section Variable Name and Variable Value now in Variable Name put PATH and in Variable Value paste the copied URL in the Step 1 then click ok.
  • Now open command prompt window and run java code.

OR OTHER METHODS

How to compile and run 1st Program in Java :- किसी भी जावा प्रोग्राम को रन करने के 2 तरीके होते है. मै जब java सिख रहा था तो हमे लैब में IDE का use करना मना था हमे सारे प्रोग्राम notepad में बनाने होते थे, और console से उन्हें रन करवाना होता था. यदि आपके साथ भी ऐसा है, तो आप console से Java Program Run  करवाना सिख लीजिये। लेकिन आपको दोनों तरीके पता होने चाहिए।

  • 1. Through IDE (Integrated Development Environment)
  • 2. Through Console

  • 1. Through IDE :- IDE से किसी भी प्रोग्राम को रन करवाना आसान होता है, बस आपको प्रोग्राम टाइप करना है और रन बटन पर क्लिक करना है. सभी IDE जैसे की Eclipse, NetBeans, VS Code etc, बटन प्रोवाइड करते है. जब हम इस बटन पर क्लिक करते है तो IDE Java Compiler को execute करता है. मै आपको सलाह दूंगा की आप एक IDE जरूर डाउनलोड करे|.
  • 2. Through Console Console से जावा program रन करवाने के steps निचे दिए हुए है|
    • 1. Run में cmd टाइप कीजिये और command prompt ओपन कीजिये| 
    • 2. Command prompt ओपन करने के बाद आप उस drive में जाइये जिसमे जावा install है और जावा के bin folder को locate कर लीजिये।
    • 3. अब आपको ये चेक कर लेना चाहिए की जावा ठीक तरह से काम कर रही है या नहीं इसके लिए आप javac कमांड टाइप कीजिये और enter प्रेस कीजिये आपको निचे की image जैसा कुछ शो होगा।
    • 4. जो प्रोग्राम आप रन करवाना चाहते है उसे बिन फोल्डर में.java extension से सेव कर लीजिये जैसे MyProgram.java. इसके बाद Command Prompt में javac command टाइप करिये और इस फाइल का नाम लिख दीजिये। जैसे की javac MyProgram.java और फिर enter प्रेस कीजिये। यदि आपके प्रोग्राम में कोई errors होगी तो वो शो जाएगी नहीं तो आप दूसरी लाइन में आ जायेंगे। ये  कमांड हमारे प्रोग्राम की executable file क्रिएट करती है| 
    • 5. अब आप java command के आगे अपनी फाइल का नाम लिख दीजिये और Enter Press  कीजिये। 
    • For Example :- java MyProgram. अब आपका प्रोग्राम रन हो जायेगा। 

First Program in Java 


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


Run this Program Platform

Now a days there are many way to run a java program. Some of these are given below
  • Using Command Prompt
  • Using NetBeans
  • Using Eclipse
  • Using Android phone

No comments

Theme images by Dizzo. Powered by Blogger.