0% found this document useful (0 votes)
21 views13 pages

1 Installation

The document provides instructions for installing the Java Development Kit (JDK) and writing, compiling, and running a simple Java program. It first explains how to download the appropriate JDK version based on the system configuration and operating system. It then outlines the installation process and describes creating a "Hello World" Java file, saving it with a .java extension, setting the path to include the JDK bin directory, using javac to compile and java to run the program, and describes some important keywords in the sample program like public, static, and void.

Uploaded by

adit.jain606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views13 pages

1 Installation

The document provides instructions for installing the Java Development Kit (JDK) and writing, compiling, and running a simple Java program. It first explains how to download the appropriate JDK version based on the system configuration and operating system. It then outlines the installation process and describes creating a "Hello World" Java file, saving it with a .java extension, setting the path to include the JDK bin directory, using javac to compile and java to run the program, and describes some important keywords in the sample program like public, static, and void.

Uploaded by

adit.jain606
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Installation of JDK

Open Link:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html

According to your system, configuration (64 bit/32 bit) /Operating System


(Windows/Linux), download JDK.
Java 8/Java 9-stable versions of Java

For installation - Double click on .exe file  click next next………Finish

Object Oriented Programming (CSEG2016)


Object Oriented Programming (CSEG2016)
Finally, we have completed the installation of jdk.

Object Oriented Programming (CSEG2016)


Write, save,compile and run my First Java program:

Open Notepad/Notepad++, type the following program.

Save it as First.java in any drive or folder. D:JAVAFirst.java

Object Oriented Programming (CSEG2016)


Please recheck the extension of saved program, it should be .java

Open Command Prompt:

Launch the command prompt via All Programs  Accessories Command Prompt.

My program location is F:\Java Code 2020

Object Oriented Programming (CSEG2016)


Check java/javac version:

Compile the program: javac is the name of Java Compiler.

OR

After compilation command, either control go on next line or it can show the
following error on screen:

Object Oriented Programming (CSEG2016)


Problem: OS is not able to recognize the .java file.

Solution 1: Setting Temporary Path :


Copy the path of jdk/bin directory where java located

(C:\Program Files\Java\jdk1.8.0_131\bin)

Write in the command prompt:

Note: In LINUX

export PATH=$PATH:/home/jdk1.6.01/bin/

Object Oriented Programming (CSEG2016)


Command for checking the values of PATH variable

Again, compile the program:

After proper compilation, the compiler will generate an intermediate


code/byte code or the .class file.

Execute the program: Java is the name java Interpreter.

Object Oriented Programming (CSEG2016)


OR

Solution 2: Setting Permanent Path:

Go to My ComputerRight click properties  advanced tab  environment


variables  new tab of user/system variable  write path in variable name 
write path of bin folder in variable value  ok  ok  ok

Object Oriented Programming (CSEG2016)


Object Oriented Programming (CSEG2016)
Object Oriented Programming (CSEG2016)
If your program gets stuck in an infinite loop, type Ctrl-c to break out.

Object Oriented Programming (CSEG2016)


Description of important keywords/parameters in the program:

public: main is called by operating system in C++ but by JVM in java, JVM can call
main only when the public mode is given before main.

static: Since JVM is calling main which is in class, so if we want to call main, an
object of class is required to call main by JVM. So JVM escape from the burden of
creating an object for the purpose of calling main().

void: indicate main(),won’t return anything to JVM.

String args[]: Known as command line arguments, String is a built in class in


java,String have every facility as for making and working on char.

Object Oriented Programming (CSEG2016)

You might also like