You are on page 1of 22

CSMDM

Problem solving Using Java


Course Name and Code : Problem Solving Using Java CSMD202
Class and Div. : Second year Div B

Prepared by,
Prof. T. R. Sathe
Assistant Professor
Department of CSE,
R. I. T., Rajaramnagar

1
Downloading and installing java
on windows

How to Set Up Your Java


Development Environment

Prof. T. R. Sathe 2
Downloading and installing java
To begin, you need to install the JDK, which includes the Java Runtime
Environment (JRE) as well as development tools, like the Java compiler ,
interpreter and debugger.

Follow these steps below:


Visit the official Oracle website
(https://www.oracle.com/java/technologies/downloads/)

Download the latest version of the JDK that matches your operating system.

Run the installer and follow the on-screen instructions.

After installation, set the JAVA_HOME environment variable to the JDK


installation directory.

Prof. T. R. Sathe 3
Prof. T. R. Sathe 4
Double click on downloaded jdk file to
start installation

Prof. T. R. Sathe 5
After that installation will start

Prof. T. R. Sathe 6
After installation you will have java
folder in your program files folder

Prof. T. R. Sathe 7
Set the JAVA_HOME Environment
Variable
1.Right click on This PC
2.Click on properties

Prof. T. R. Sathe 8
Click on advanced system settings

Prof. T. R. Sathe 9
In new window click on Environment
variables

Prof. T. R. Sathe 10
In system variables click on new
button

Prof. T. R. Sathe 11
Set the "Variable name" as JAVA_HOME In the "Variable
value" field, enter the path to the JDK installation
directory.

Prof. T. R. Sathe 12
Path of JDK installation directory

Prof. T. R. Sathe 13
Check JAVA_HOME variable using command
echo %JAVA_HOME% un command prompt

Prof. T. R. Sathe 14
Congratulations now you have successfully
installed java on your windows system . now let
us write and execute simple hello world java
program .

Prof. T. R. Sathe 15
Writing Your First Hello World in Java
with notepad.
1.Open notepad on your computer and type following code.
class Helloworld

public static void main(String []args)

{
System.out.println(“Hello World”); // prints Hello World

Prof. T. R. Sathe 16
Save this file with Helloworld.java file(Name of
class which contains main method)

Prof. T. R. Sathe 17
Now compile this file in command
prompt
Open command prompt from your PC and
change drive to the drive where you have
stored the java program ,in my example I have
stored it to D drive . Now type following
command and press enter.
Javac Helloworld.java

Prof. T. R. Sathe 18
If it is not show any error then your
program is compiled successfully

Prof. T. R. Sathe 19
Now execute program
Type following command in command prompt
Java Helloworld

Congratulations students ,you have successfully


executed first java program

Prof. T. R. Sathe 20
Program explanation
1.Class declaration:Class is declared using class key word
public class Helloworld { }
2.Main Method:It is entry point for program execution

public static void main(String[] args):

This line declares the main method, which is the entry point of the
Java program. It's where the program starts its execution.

public static void: These modifiers indicate that the method is public
(accessible from outside the class), static (belongs to the class rather
than an instance), and returns no value (void).

Prof. T. R. Sathe 21
3.print statement
System.out.println("Hello World");
System.out.println("Hello World");: This line
prints the string "Hello World" to the screen.
The println method is part of the System.out
object

Prof. T. R. Sathe 22

You might also like