Vision and dreams are the blueprints of soul and achievements.
-Mohammed Ahmed F

You might not know about Java

Folks,

What is Java?

Java is a simple, flexible (platform (operating system) independent) and class based programming language.

Though it is class based programming language it is also a WORA based programming language.

WORA means Write Once Run Anywhere programming language.

The best way to practise Java programs is to type them in any text editor and save the file using the extension ".java". For instance, File_Name.java

Before we compile the saved .java file, we need to install the JVM - Java Virtual Machine.

JVM is the only thing which makes java a special language. I.e., independent language.

As a computer understands only 1's and 0's, JVM converts every application wirtten or developed in Java in ByteCode which is nothing but the 1's and 0's which a computer understands.

Hence if you want to run the application developed using Java in your client machine than we need to install JVM in our client's machine.

Well, I hope that you are clear with JVM now.

And now we will learn how to compile our java program to ensure that our program is error free - syntax error or spelling.

Before we go for compliation, we need to install JDK - Java Development Kit in our machine. I.e., in which we are developing the application.

After installing JDK in our machine we need to ensure that our Command Prompt is able to identify the JDk installed.

To do so, open run and type "cmd" and click OK.

A dialog box will open, type in the textbox "cmd" to open the command prompt.

Type "javac" and type enter.

If it says that it is unable to identify the javac command on the machine than follow the following steps.

Right click on the My Computer / Computer and select "Properties".

There you can see "Advanced System Settings". Click on it.

A dialog box will open, select the "Advanced" tab under which you will find the "Environment Variables..." button, click on it.

There you will find 2 group boxes namely "User Variables for {YOUR_SYSTEM_COMPANY_NAME}" and "System Variables"

Under "System Variables" group box, select the Value of "Path".

And Add the your JDK path to it. Note: Do not delete the existing paths as it will stop the linked applications for running anymore.

Just add as ";" to the existing paths listed therein and add your JDK path into it and click OK.

My Path is "C:\Program Files\Java\jdk1.7.0_45\bin".

Now open the command prompt and type "javac" and check whether it is able to identify.

Now it should.

Well, after that, you complie your java program by going to the path in which you have saved you java file using the command prompt itself.

And now compile your Java program as "javac File_Name.java"

If there is error than debug it.

Note: After the successful compilation of the program, a file will get generate as you main class name.

Now you need to run the class file as "java Class_Name _To_Run".

It is not mandate that you save the file as the class name but it is highly adviced to do it to avoid confusion.

It is absolutely not like that only one file will generated after the successful compilation of the program but "n" number of files will get generated based on the "n" number of classes you have in your java program.

Well, Happy Coding :)

-Chief Administrative Officer.

Share this

Related Posts

2 Comments and Discussions

Comments and Discussions
Tuesday 4 November 2014 at 14:59:00 GMT+5:30 delete

"Good article,your introduction of java is very detailed.After reading this,now i actually know something about java.Java is a computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers ""write once, run anywhere"" (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode that can run on any java virtual machine (JVM) regardless of computer architecture.

Reply
avatar

Dear User,

Thank you for your comment. Hope you like this blog. Kindly share us on Social Media so others can be updated.

-Chief Administrative Officer.

Note: only a member of this blog may post a comment.