top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Introduction to JDK

0 votes
258 views

Java Development Kit

The Java Development Kit (JDK) is provided by Sun Micro systems and is popularly used by Java programmers worldwide. The purpose of JDK is to provide the software and tools required for compiling, debugging and executing java applications. The JDK software and documentation are freely available at Sun’s official web site.

Java Standard Edition, popularly called Java SE, is a technology and platform that provides support to build applications that have high functionality, speed and reliability. Java SE development kit, popularly called JDK, includes the necessary development tools, run time environment, and APIs for creating Java programs with the Java platform.

JDK includes two important tools:

  • Javac (compiler): The javac compiler is used to compile java source code into byte codes. The source code can be created using an integrated development environment like NetBeans or a simple text editor like notepad.

Javac [option] source

Where,

Source is one or more files names that end with the extension .java

  • Java (interpreter): The java interpreter is used to interpret and run java bytecodes. It takes the name of a class file as an argument for execution.

Java [option] class name [arguments]

Where,

Class name is the name of the class file.

Configuring JDK

To work with the JDK and java programs, certain settings need to be made to the environment variables. Environment variables are pointers pointing to programs or other resources. The variable to be configured are:

PATH: The PATH variable is set to point to the location of java executable (javac.exe, java.exe.) This is necessary so that the javac and java command can be executed from any directory without having to type the full path.

Setting path in DOS:

C:\>set path=<drivename>:\<installation_folder>\bin

Setting path in Windows

  • Right-click the computer icon present on the desktop.

  • Click on properties.

  • Click Advanced tab.

  • Click Environment variables.

  • In the system variable area, select the PATH variable.

  • Click Edit button.

  • Enter the path of the bin folder of jdk 7 or jdk 8

CLASSPATH

CLASSPATH is an environment variable that specifies the location of the class files and libraries needed for the java compiler (javac) to compile applications.

Setting CLASSPATH in DOS:

C:\>set CLSSPTH=<drivername>:\<installation_folder>

Setting CLASSPATH in windows

  • Right-click my computer icon present on the desktop

  • Click on properties. Click advanced tab

  • Click on environment variables, and then in system variables area click on new

  •  Type CLASSPATH in variable name and then type c:\jdk (jdk version) as value. 

  • Click on ok.

More: While setting PATH and CLASSPATH variables in a system, log on as system administrator, otherwise the system variables area is disabled. CLASSPATH is also required by the java interpreter (java) to interpret and run the applications.

References

Effective Java by Joshua Bloch
posted Jun 17, 2017 by Mantosh Dubey

  Promote This Article
Facebook Share Button Twitter Share Button LinkedIn Share Button


Related Articles

Object

An object is the software representation of a real-world entity. For example, objects in a railway reservation system may include a train, a journey destination, an icon on a screen, or a full screen with which a railway booking agent interacts. Any tangible entity in the real-world can be described as an object.  Example of real-world entities around everyone, such as a car, bike, flower or person.

Every entity has some characteristics and is capable of performing certain actions. Characteristics are attributes or features describing the entity, while actions are activities or operations involving the object.

For instance, consider a real-world entity such as a Toyota or a Ford car. Some of the characteristics associated with a Toyota or Ford car are:

  • Color

  • Make

  • Model

Some of the actions associate with a Toyota or Ford car are:

  • Drive

  • Accelerate

  • Decelerate

  • Apply brake

 

Software Object

The concept of objects in the real-world can be extended to the programming world where software “objects” can be defined.

Like its real-world counterpart, a software objects has state and behavior. The “state” of the software object refers to its characteristics or attributes whereas the “behavior” of the software object comprises its actions.

For example, a real-world object such as a car will have the state as color, make a model and the behavior as driving, changing gear and increasing speed, applying brakes.

The software objects stores its state in fields (also called variables in programming languages) and exposes its behavior through methods (called functions in programming languages).

 

Defining a class

In the real-world, several objects having common state and behavior can be grouped under a single class. For example, a car (any car in general) is a class and Toyota car (a specific car) is an object or instance of the class.

A class is a template or blueprint which defines the state and behavior for all objects belonging to that class.

Typically, in an object-oriented language, a class comprises fields and methods, collectively called as members, which depict the state and behavior respectively.

 

comparison

Class

Object

Class is a conceptual model

Object is a real thing

Class describes an entity

Object is the actual entity

Class consists of fields (data members) and functions

Object is an instance of a class

READ MORE
...