Step 1: Download JAVA and Net Beans or Java Standalone Setup and JDK

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

QUESTION 1

Step 1: Download JAVA and Net beans or Java standalone setup and JDK
1. Go to www.oracle.com to download the java and net beans setup.( jdk-8u111-nb-8_2-
windows-x64.exe). or 32 bit.
2. If you want to download an independent setup of java download the setup that’s
compatible to your platform (operating system).
3. Download the JDK (java development kit) version of the java setup as well.

4.

Step 2: Installing Java and Net beans


1. After downloading the java and net beans package from the Java website
www.oracle.com, extract the package and run the setup to begin the installation.
2. Once you run the package it installs both java update 8, Java development kit and the
compiler net beans.
Step 3: Include JDK's "bin" Directory in the  PATH
Windows' Command Prompt (CMD) searches the current directory and the directories listed in
the PATH environment variable (or system variable) for executable programs. JDK's programs
(such as Java compiler "javac.exe" and Java runtime "java.exe") reside in the sub-directory "bin"
of the JDK installed directory. You need to include JDK's "bin" in the PATH to run the JDK
programs.
To edit the PATH environment variable in Windows 10:
1. Launch "Control Panel" ⇒ (Optional) "System and Security" ⇒ "System" ⇒ Click
"Advanced system settings" on the left pane.
2. Switch to "Advanced" tab ⇒ Click "Environment Variables" button.
3. Under "System Variables" (the bottom pane), scroll down to select variable "Path" ⇒
Click "Edit...".

4. Variable name: PATH

Variable value: c:\Program Files\Java\jdk-13.0. {x}\bin; [do not delete exiting entries...]

Step 4: Verify the JDK Installation


Launch a CMD via one of the following means:
1. Click "Search" button ⇒ Type "cmd" ⇒ Choose "Command Prompt", or
2. Right-click "Start" button ⇒ run... ⇒ enter "cmd", or
3. Click "Start" button ⇒ Windows System ⇒ Command Prompt
Issue the following commands to verify your JDK installation:
1. Issue "path" command to list the contents of the PATH environment variable. Check to
make sure that your JDK's "bin" is listed in the PATH.
2. path

PATH=c:\Program Files\Java\jdk-13.0.{x}\bin;other entries...

3. Issue the following commands to verify that JDK/JRE are properly installed and display
their version:

QUESTION 2
What is JVM all about, and how to it makes it possible to run java on multiple platforms.

Java Virtual Machine (JVM) is an engine that provides runtime environment to drive the Java
Code or applications. It converts Java bytecode into machines language. JVM is a part of Java
Run Environment (JRE). In other programming languages, the compiler produces machine code
for a particular system. However, Java compiler produces code for a Virtual Machine known as
Java Virtual Machine.

Here is how JVM works

First, Java code is firstly complied into bytecode. This bytecode gets interpreted on different
machines

Between host system and Java source, Bytecode is an intermediary language.

JVM is responsible for allocating memory space.

The JVM is OS-dependent, byte code isn't which enables java programming language to run on
multiple platforms.

This means that bytecode is a sort of "generic" language that JVM will interpret end execute
according to the system it's running on.

With Java, the CPU executes the JVM, which is platform dependent. This running JVM then
executes the Java bytecode which is platform independent, provided that you have a JVM
available for it to execute upon. You might say that writing Java code, you don't program for the
code to be executed on the physical machine, you write the code to be executed on the Java
Virtual Machine.

QUESTION 3
What the Java API (Application Programming Interface) all about.
- Java application programming interface (API) is a list of all classes that are part of the
Java development kit (JDK). It includes all Java packages, classes, and interfaces, along
with their methods, fields, and constructors. These prewritten classes provide a
tremendous amount of functionality to a programmer. A programmer should be aware of
these classes and should know how to use them.
- There are packages written for GUI programming, networking programming, managing
input and output, database programming, and many more.

- In order to use a class from Java API, one needs to include an import statement at the
start of the program. For example, in order to use the Scanner class, which allows a
program to accept input from the keyboard, one must include the following import
statement:
import java.util.Scanner;

- The above import statement allows the programmer to use any method listed in the
Scanner class. Another choice for including the import statement is the wildcard option
shown below:
import java.util.*;
This version of the import statement imports all the classes in the API’s java.util package
and makes them available to the programmer. If you check the API and look at the
classes written in the java.util package, you will observe that it includes some of the
classes that are used often, such as Arrays, ArrayList, Formatter, Random, and many
others.

- Another Java package that has several commonly used classes is the
java.lang package. This package includes classes that are fundamental to the design of
Java language. The java.lang package is automatically imported in a Java program and
does not need an explicit import statement. Please note that some of the classes that we
use very early in Java programming come from this package. Commonly used classes in
the java.lang package are: Double, Float, Integer, String, String Buffer, System, and
Math.

You might also like