Tuesday, 23 September 2014

java Architecture


By the end of this Article you will be able to understand

The Architecture of Java Language.

Java Program Execution Process



Now let us Understand the Java Architecture. 

As shown in above figure,

1) Java program source files are saved with extenion .java(dot java).

2) This   .java  file is compiled using java compiler which creates a file with extension  .class  
known as byte code.


JVM Parts


3) Then the java runtime environment (JRE) runs code compiled for a JVM.

4)The Class Loader performs the tasks of loading all .class files for the execution of a program.

5)The Byte Code verifier verifies the code that tests the format of code fragments and checks code fragments for illegal code.

6)The interpreter executes the code.









By the end of this article you will be able to 

1)Install java into your system

2)Create and Run (Execute ) a Java program by yourself.


Lets us first discuss about the java installation topic.

So, you people know that to run or execute your java programs in your system you need JDK (java)or Java Development Kit, which contain the necessary files useful to run programs in your system.

Oracle is the company which is developing the java jdk.

So to download jdk we need to go for oracle website which host java jdk for download.

Java JDK Downloading site details



As shown in above figure. You have to go to

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

And choose the appropriate version to download.

To know which version to install follow below steps:


 Go to my computer or right click on computer and then go for properties there you can see the windows version of your system.So, basing on that you can download the respective version from the site.

Downloading jdk 


                          Then you need to double click on the downloaded file. Then one pop up window will be displayed asking for permission to install in hard disk.Click OK then the installation process will start.click next option for next screens.




                          Then It will prompt you for jdk installation directory there you can leave it to install in default drive (i.e. max in c drive) or you can choose any other location you want.
And then after the jdk will be installed in your system.

Now you can go to the installed jdk folder and see the structure.

jdk Architecture

It will be like the above showed picture.

Now to tell the system that you have installed the java jdk and to run programs using this jdk 

follow these steps carefully.

Setting the path variable in windows:

1)Go to installed  jdk folder and copy the bin directory address as shown in below figure.

Copy the bin folder address



2)Go to computer and right click on it.

3)choose  properties option

4) then go for Advanced system settings at the left side of screen as shown below.

Go for Advanced system setting 


5)Then in the appeared window go to environment variables button.

Go for Environment Variables


6)in the shown window under user variables click on new .


7)Now in the first field enter path as shown in the above figure and in the second filed add the 
the path of your bin folder which is copied earlier.

8)click OK and then click OK in remaining screens as well.

That's it. Now you installed java in your system successfully.


Now you can check whether java is installed successfully or not in your system by following below steps.

Java installation check:

1)Go to start button.

2)Then in search type cmd.you will get command prompt .

3)clicking on command prompt will open it.

4)Then at the > symbol type   javac and click enter key in keyboard.

checking java installation



Then if it displays so much content as shown in the above figure, then that means java is installed in your system successfully.

congratulations you installed java successfully !.

Now lets create and execute java programs.


Creating and Executing Java Program:

1) open one text editor. For example notepad is a text editor.So open notepad.



2) In the notepad write the code you want if you know java progamming language or write the code as shown in the below figure. I will explain the whole program and its structure in the coming articles. For now just copy the code as shown in the below figure into the notepad file.


A simple java code to display Helloworld.



                    Here as you can see, I am writing one class with name Helloworld and in that class I am writing on main method in the method  I am writing one console print statement to display Helloworld message on console.I will clearly explain these in the next concepts.

3) Now, save this file in your jdk folder with name as Helloworld and with .java extension.
So your file name will be  Helloworld.java.So now our source file is ready.Note that our file name is similar to name  of the class which is public.Here Helloworld is the name of the class which is public in our source file, that is why we have saved the source file as Helloworld.java.Don't worry we will see this concept later.

 Executing the source file:


1)Go to command prompt

2) go to the jdk folder by typing the command as shown in the below figure

i.e if your jdk folder is in c directory just copy the jdk folder address and paste it after typing cd
ex: c:\>cd programing files\java\jdk

or else enter the driver name if you have installed jdk in other drives  and : ( colon)
ex: c:\>e:then it will change to e drive.

 then after that copy the jdk folder address where we have saved our source file.And paste it after typing cd space.And click enter.



Go to the folder where we have stored our file 



3) And now, type javac Helloworld.java.
here javac is compiler and Helloworld.java is our source file.So we are telling our computer to compile the Helloworld.java file with the compiler javac. If it is success it will display next line.Otherwise it will display the respective error.

4) Now our source file is compiled and the .class file is generated for us.You can check whether .class file is created or not by simply going to folder where we have stored the source file.And there we can fie a file Helloworld.class .This file is also called as byte code file. which contain only 0's and 1's.

5)Now we have to interpret and run this .class file.To do that go to command prompt and type 
java Helloworld.




Note that we should not give any extention after Helloword. Here the Helloworld is class file and java is the interpreter.So we are telling the machine that interpret and run the Helloworld class which is generated with java interpreter and display the output.

If there are no errors then  you can see Helloworld ! message on you console here command prompt.


Congratulations as you had written and executed your java program successfully.

Summary:

By reading this article you are able to understand the jdk architecture and also able to create , execute the java file successfully.

Thank you.
.

Monday, 22 September 2014

Features of Java Programming Language


Features of Java Programming Language



By the end of this Article you will be able to:

1)      Understand Features of java.

Features of java programming language:

1)      It’s a high level language:

Note: A high level language is a programing language in which all the commands will be in general English language only.
                In machine level language all the commands will be in 0’s and 1’s only.
So in java almost all the commands we use to write programs are high level (English) words only.

Levels of programing languages we can say based on words we use:

Low level or machine level language: All the commands will be in 0’s and 1’s difficult to understand.

Middle level language: If you can see in c, more commands are in English only even though some commands like pointers we cant understand just by reading them. So because of the properties like these c is called as middle level language.

But if you can see in java, all the commands will be in high level language only. That’s why java is called as high level language.


2)      Simple:

If you know c and c++ programing then after learning java programing language you can feel that java programming is easier than c and c++.
No need to understand pointer to code in java language. As in java there is no concept called pointers.

Let us understand Features of Java. Java is Simple language means Certain complex features like operator overloading, multiple inheritance, pointers, explicit memory de allocation are not present in Java language. This makes java simple.

3) Platform Independence:

                                          A platform is nothing but the hardware and software environment in which a program runs.You know that in c language if you write one program and compile the file then you will get one exe file, by executing (running or double clicking) which we will get output.
Had you ever tried copying that exe to other system and executing it?
If your system has same configurations and software as the system in which the exe file created. Then its fine otherwise the exe file will not going to run In your system at all.
                                          This is the disadvantage of c and c++ they are PLATFORM DEPENDENT languages. Which means if you develop one application using c language then you can’t executing the same application in some other system which is having different configuration.
But unlike c and c++ java language has different mechanism.
                                           If write one source file in java language then after compiling the file using compiler you will get one class file( which contain byte code series of 0’s and 1’s) then you can take the class file and you can run this class file through any system in which the jdk(java development kit) is installed.
                                            So to run any java language written program you need jdk.we will discuss about jdk later in the following posts.

That means a java code complied on windows system can be run on UNIX system without any modification in code.

More about platform independence and java architecture in coming post. Don’t miss it guys.

Thank you.

Sunday, 21 September 2014

Programing Language and Compiler


PROGRAMING LANGUAGE




Hi guys today lets start from basics

Lets say I gave you one mathematical question to find out multiplication of two numbers say suppose
2*3?

It will not take you more than few seconds to answer. It’s a silly thing right. But guys what if i ask you to tell me value of 4567*3457??

Now it will take you few minutes to calculate right.

And what about the calculations that are having 7 digits or 9 digit numbers??

You will definitely able to solve that but they are going to take lot of time.

What if you have a calculator application that will calculate multiplication of two numbers?  I know that you are going to tell me any value within few seconds.

             So that is the use of a computer application (here calculator). Yes, here calculator is a small computer application for which you will give some inputs (numbers 2, 3 and a symbol of multiplication *) then it will give you the result within fraction of seconds.

                        So we as developers should know how calculator application is able to do these calculations, right??You know that computer is just a machine which execute the commands(list of words)  you give. In the same way if you design one set of statements so that whenever you give two numbers as input It will return multiplication of those two numbers. Then you don’t need to worry on the length of numbers involving in the multiplication. Whatever the numbers are, you just enter those numbers and the calculator application will calculate the multiplication within few seconds without any errors. And you can calculate any number of multiplications without any waiting time.
So the main advantages of computer applications are

1) They are very accurate, that is they will give you the answer based on your code without any diversions.
2) They are very fast.
3) They are robust.



For Example:

Let’s take an example of calculating multiplication of two numbers:
Problem statements:
1) My application has to ask me to enter two numbers.
2) When I enter two numbers and press enter button, it has two show multiplication of entered numbers.

So this is the problem statement.

Note:
For the companies the clients will provide this problem statement only, through frd documents. But since they want lot of functionalities their requirements (problem statements) document will be around 30 to 40 pages.
Now we know the problem statement right.
Let’s note down some main points to full fill the requirement (problem statement)

1)      Take two numbers let’s say A and B
2)      Calculate multiplication of two numbers A *B
3)      Display the result to client(the person who uses our application to calculate multiplication of two number)

                        You can see that we fetch three main points from the problem statement that we have to do.This process of writing main points from the problem statement in general language (here in English) is nothing but Pseudo Code of the application.
So know we know the steps we need to follow, right.
Know we will move forward to convert these general language statements (English statements) into the language statements which cpu(your processor) can understand.
Unlike English language which contain 26 alphabets, cpu can understand the language which contain 2 alphabets 0 and 1.

Here 0 = power off
          1= power on.

               Since CPU is a digital circuit (an electronic circuit) it works when we supply power to it. But we have designed the cpu such that if we give different combinations of power on and power off (like 1010001, 000111)
It will behave differently.CPU circuit is combination of several small circuits. We have designed that small circuits which can give us the output that we want when we supply particular power series to them as input.

Example of small circuits:

1) AND circuit or AND gate: which give us




                           As you can see for this circuit we have 2 input terminals (wires) and one output terminal (say suppose one small bulb which glows when it get power to know the result)

                           So as stated in above table, if you don’t give power to two input wires then the output is 0 that is the bulb doesn’t get power which means it doesn’t glow.
When you give power to two inputs then only the bulb gets power to turn on.
So this is the small visual of what is happening in the cpu. Cpu is the combination of lot of small circuits like this.

                             So when you give power supply in some series of 0‘s and 1’s it will give the output as designed by the designers of cpu.Let’s say you have to multiply two numbers 2 and 3. Then first you have to convert 2 and 3 into series of 0’and 1’s and after the calculation the output will be in the series of 0’s and 1’s. Then again you have to convert the output into numbers.
Let’s say some client asked us to design one application to calculate the remainder when 10/2 and display the remainder if the remainder is not equal to 0.

                                Here in addition to calculation you need to check the remainder that if its zero or not. In this case we have to use IF. Which is not numeric. But how to convert the word IF into 0’s and 1’s.And what if we need to do repetitions in calculations.
So the Computer scientist had represented each every key in the keyboard with some combination of 0’s and 1’s.

                                 And they also assigned some unique combinations to words commonly used in calculation statements such as IF, WHILE etc...And they also designed one structure to give inputs to CPU circuit and stated that as programing language. And they had designed some programs which converts the numbers and words (2,3,IF, WHILE etc., into series of 1’s and 0’s) which reduce the burden of converting . They named those programs as compilers and interpreters.




Compiler: A compiler is a computer program which convert the high level language (English statements) into machine understandable language (1’s and 0’s) at once.
Interpreter: And Interpreter is also a computer program which convert the high level language (English statements) into machine understandable language (1’s and 0’s) line by line.

                  As developers we write programs using progaming language structure acceptable by compilers and interpretes. Any program not acceptable by compilers is not allowed to convert into machine language.
So we must write the programs which are compiler error free programs.

For example:

Let’s say the multiplication example.

If you give input as in general English. The cpu will give different output since we are not giving input to cpu in the way that was designed.

So we need to follow the structure noting but programing language.
Here different scientist created different structures to code for the cpu.

Ex: C language, java language etc.,

Since we are focusing on java language I am going to tell you the structure of java language

A typical java language structure to implement multiplication of 2 numbers is as follows

1)      Int a=2;  // assigning value 2 to integer variable ( a variable or symbol which takes only integer)                               
2)      Int b=3;
3)      Int c=a*b; // storing multiplication result into another variable c
4)      System.out.println(“ multiplication of two numbers= ”+c);
5)       
6)      // java typical print statement to display result in console

                         Later some scientists and programmers gave different modifications bound to core structure to reduce the calculation time or storage space.
In the next post we will learn the speciality of java language. And why it is different from other languages like c and c++ and some more concepts.


Thank you.

Saturday, 20 September 2014

                       And once they allocated the system. They will give you the system which is completely formated( which means they will delete all the software and documents).

                     And you are going to have the system in which you will find nothing. And then you will have to raise tickets( which means you have to make requests to system servicing people of the organization)to install necessary softwares. I have rised tickets for the installation of eclipse,jboss and browser.Then after two days they will install the softwares in your system through remote access by taking control of system with your permission or directly coming to your system.And from then onwards your work will start.

                        In your organization others will install the necessary softwares but for now you have to install eclipse and jboss by yourself( dont worry I will tell you how to do that just follow my instructions.)






Hi guys today we are going to discuss the life after getting placed in a mnc.


See Guys when you join in a mnc as a fresher, you will put into training for min 3 to 6 months.During which they will teach you basic programing languages.
You dont have any choices of choosing the stream in which you have to work for the rest of life.Simply you will be informed that you have to join this language course thats it.

And the training days shall be quite interesting as you are going to enjoy in these days. But please concentrate on the subject as well because this is the thing going to help you after training.Because you will be posted to different different regions one you complete the training.You dont have any choices to choose the place to work.

And there no one will be there to help you in your work getting done.So the training is the cruisial part of starting job life.And whatever you learn there be carefull about that.

And after posting you will have to wait for minimum 1 month to get a system allocated to you.

Hi guys,


              Today I am going to tell you the requirements that are given to me for my next application that I have to design.This is my second application in the company.I will tell you about my first application later in the coming posts.

               I am supposing that I can give you clarity on Application while I am designing the application so thats why I want to start with my second application.

So the requirements are as follow,

I have to design one application using JSF, hibernate and Sybase that will fetch and display the records from database.

The application Screens are as follows,

1) The first screen of the application is LOGIN PAGE

            The user can login into application using one login page which asks for user name and passowrd that the user has to login into application.

2) Second page of the application is SEARCH PAGE

            After user login into application using login page sucessfully, I have to display one page in which user has to enter some fields and has to press search button provided.

So, basing on the search parameters the user provided the records in the database should be displayed in the rich data table( no need i ll explain what is rich data table ) under the search parameters in the same page.

3) And we have to provide one logout button and one help button to user using which user can logout from the application and go for help.


So this is my second application that I am going to start my design from monday. I will update whole process along with images also.So I will post each and every thing I had done in daily bases. Dont forget to follow this page daily , otherwise It will be difficult for you to manage the subject.

All the best guys.