«

»

May
16

Basic Concepts in Java

What is Java?

Java is an object oriented programing langauge, it is created by Sun Microsystems, and their specifications are manged by the same company (currently by Oracle).

Why I need Java?
Java comes with a very big advantage. It can be used in different platforms through its byte-code. So it offers a complete portability making application independent from the run environment. It’s not necessary to have a particular OS. With this language you can develop desktop-oriented, web and embedded systems applications.

What I need to work with Java?
You need two tools (or kits):

  1. JRE : Java Runtime Environment, if you want to execute Java code. In this kit you have standards libraries and the JVM (Java Virtual Machine) to execute the byte-code.
  2. SDK : Standard Development Kit, if you want to write your own code. This kit offers you a JRE, Java compiler, many samples programs helping you to understand the Java philosophy, and the source code of the API.

Where I can find the SDK?
Currently form the Oracle official web site if you use Windows, Linux, Solaris. You choose the kit that is compatible with your OS. But if you use a Mac Os you have to go to the Apple official web site.

And the next step?
Install the SDK, it differs from OS to others, but it respects the same logic. A good practice here is to create a Java folder within you install your SDK especially if you work with Microsoft Windows, because the default folder is «Program files» and it can cause problems when you will exploit your JRE.

  • You install your SDK in a folder in your machine (Java folder)
  • You configure your path by adding an environment variable that you call «PATH», the value of this variable must be the «bin» folder (you find it in installation folder of your SDK). If this variable exists, don’t erase its value, but you add the new value :
    PATH = old_value_PATH;SDK_instalation_folder/bin
  • You verify the installation by typing in your Command Line Console «javac -version». If the installation is valid you will get the version of your SDK, else you verify the path of your installation folder and the value of  «PATH» variable.

Where I can write my Java program?
Where you want. In fact, you can put your source code where you want. A good practice here is to create a independent folder easily accessible (don’t use spaces in the name). To edit your source code, you have two solutions:

  1. Use your favorite editor, in this case you have to compile your code manually by typing in your Command Line Console «javac -c PATH_OF_YOUR_SOURCE_CODE», and the program will be executed in the same console. This practice is not good.
  2. Use an IDE (Integrated Development Environment), Eclipse or NetBeans in general. the IDE offers you a complete environment of development with many useful application : Colored Editor, Syntax Corrector, Complier, Run Environment, and more… all are accessible by mouse clicks or keyboard shortcuts. This practice is good.

What is the «CLASSPATH»?
«CLASSPATH» is the place where JVM has to get byte-code and other resources. The value of the «CLASSPATH» contains a list of elements that can be *.jar or *.zip. The JVM look for resources in «CLASSPATH» in the order of theirs declaration.

 

See also :

Share it with your freinds on Facebook Tweet it to your freinds on Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon

2 comments

No ping yet

  1. Vender ouro says:

    Whats up! I just would like to give a huge thumbs up for the good data you have here on this post. I will likely be coming back to your weblog for more soon.

  2. iphone5reviewed.com says:

    Another day another awesomely written article, thank you for putting in the time!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP SlimStat