Lab01 Java Installations

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

www.yuktisoftwares.

com
+91 9582815419

JAVA INSTALLATIONS

Lab 01

YuktiSoftwares
1 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Contents
Java Installation: ........................................................................................................................................... 3
Download jdk ............................................................................................................................................ 3
Install JDK .................................................................................................................................................. 5
Verify installation .......................................................................................................................................... 9
Set path ....................................................................................................................................................... 11
Verify path: ............................................................................................................................................. 13
Set classpath ............................................................................................................................................... 15
Run HelloWorld program. ........................................................................................................................... 16
Steps to run program: ............................................................................................................................. 16
Program execution steps ........................................................................................................................ 18

2 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Java Installation:
Download jdk
1. Open link: https://www.oracle.com/java/technologies/javase-jdk16-downloads.html

2. Based on your OS download jdk exe file (suppose my system is Windows 64bits)

3 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

4 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Install JDK
1. Double click on exe file

2. Click on Next

3. Update installation folder location by clicking on change button.


(Before changing it looks like below)

5 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

4. After changing installation folder location, it looks like below

5. Click on ok.

6 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

6. Click on Next

7. When installation completes it will show below screen, Click on close.

7 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

8 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Verify installation
1. Go inside the installation folder (inside bin folder)
Ex: D:\INSTALLED_SOFTWARES\Java\jdk-16.0.1\bin
2. you can see java.exe, javac.exe files

3. Open command prompt and go to inside bin folder


Ex: D:\INSTALLED_SOFTWARES\Java\jdk-16.0.1\bin

4. run command

java -version

5. You should be able to see installed java version.

9 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

10 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Set path
1. Right click This PC (My Computer), click on Properties

2. Click on “Advanced System Setting”

3. Click on “Environment Variables…”

11 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

4. Select “Path” under System variables section, Click on Edit button

5. Click on New button, and add path upto bin folder.


Ex: D:\INSTALLED_SOFTWARES\Java\jdk-15.0.1\bin

12 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

6. Move this variable on top, using “Move Up” button

7. Click on OK, ok, ok in different windows.

Verify path:
1. Open command prompt (any folder location) and type following command:
java -version

13 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

2. Run “javac” command

3. Run “javac -version” command

14 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Set classpath
1. Go to environment variable window

Click on New

Add variable name: CLASS-PATH


Variable value: .

2. After addition it will look like below

15 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Run HelloWorld program.


Steps to run program:
1. Create a file fileName: P1_HelloWorld.java
import java.io.*;
class P1_HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}

2. Go to file location from command prompt and run following commands.


javac P1_HelloWorld.java

3. Run another command:


java P1_HelloWorld

16 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

4. Check output “HelloWorld”

17 www.yuktisoftwares.com
+91 9582815419
www.yuktisoftwares.com
+91 9582815419

Program execution steps

1. Working of Java Program

P1_HelloWorld.java ➔ javac P1_HelloWorld.java➔ P1_HelloWorld.class→


java P1_HelloWorld→output

18 www.yuktisoftwares.com
+91 9582815419

You might also like