Java is an object-oriented, cross platform, multi-purpose programming language produced by Sun Microsystems. First released in 1995, it was developed to be a machine independent web technology. It was based on C and C++ syntax to make it easy for programmers from those communities to learn. Since then, it has earned a prominent place in the world of computer programming.
Java has many characteristics that have contributed to its popularity:
- Platform independence – Many languages are compatible with only one platform. Java was specifically designed so that it would run on any computer, regardless if it was running Windows, Linux, Mac, Unix or any of the other operating systems.
- Simple and easy to use – Java’s creators tried to design it so code could be written efficiently and easily.
- Multi-functional – Java can produce many applications from command-line programs to applets to Swing windows (basically, sophisticated graphical user interfaces).
Java does have some drawbacks. Since it has automated garbage collection, it can tend to use more memory than other similar languages. There are often implementation differences on different platforms, which have led to Java being described as a “write once, test everywhere” system. Lastly, since it uses an abstract “virtual machine”, a generic Java program doesn’t have access to the Native API’s on a system directly. None of these issues are fatal, but it can mean that Java isn’t an appropriate choice for a particular piece of software.
See History of Java article section at Wikipedia
The Java Platform
One thing that distinguished Java from some other languages is its ability to run the same compiled code across multiple operating systems.
In other languages, the source code (code that is written by the programmer), is compiled by a compiler into an executable file. This file is in machine language, and is intended for a single operating system/processor combination, so the programmer would have to re-compile the program seperately for each new operating system/processor combination.
Java is different in that it does not compile the code directly into machine language code. Compilation creates bytecode out of the source code. Bytecode generally looks something like this: a7 f4 73 5a 1b 92 7d
When the code is run by the user, it is processed by something called the Java Virtual Machine (JVM). The JVM is essentially an interpreter for the bytecode. It goes through the bytecode and runs it. There are different versions of the JVM that are compatible with each OS and can run the same code. There is virtually no difference for the end-user, but this makes it a lot easier for programmers doing software development.
Installing the Java Development Kit:
Before installing the Java Development Kit (JDK), you should probably know what it is. It is distributed by Oracle. It contains the core libraries and compiler required to develop Java. The JDK should not be confused with the JRE (Java Runtime Environment). The JRE is a JVM for running, as opposed to compiling, Java programs.
Downloading and Installing
To download the JDK, go to http://www.oracle.com/technetwork/java/javase/downloads/index.html. Click on “JDK with NetBeans Bundle”. Follow the instructions for downloading the JDK installation file.
Windows: If you are running Windows, simply run the executable file and follow the installation instructions.
Unix, Solaris, or Linux: For Linux and Unix, download the “jdk1 6.0” for Linux systems. Save the downloaded file in any drive. Once you have saved the file, extract it to a place that you can remember, by using Terminal or by double clicking on the file. When you have finished extracting the file, copy the JDK 1.6.0 folder and paste it in the usr/local(To paste to the usr/local directory, you have to be in root) so that every user can use the java files. You can delete the downloaded zip file so that it doesn’t take up space on your drive.
Note on Editions
The JDK comes in three editions.
- Java Standard Edition (JSE) – This version is the basic platform for Java. The course will focus on this edition.
- Java Enterprise Edition (JEE) – This edition is mainly for developing and running distributed multitier architecture Java applications, based largely on modular software components running on an application server. We will not be covering this version in the course.
- Java Micro Edition (JME) – This edition is primarily for developing programs to run on consumer applicances, such as PDAs and cell phones.
Before writing code, it is recommended that you set the Path variable on your system so you can compile your code more easily.
For Windows Users
- From the Control Panel, double click “System” (System and Maintenance in Vista)
- For Windows 7 or Vista, click on “System,” “Advanced System Settings” on the left, and then on “Environment Variables.”
- For XP and 2000, click on the “Advanced” tab and click on “Environment Variables” For NT, click on the “Environment” tab.
- Select the Path variable and click “Edit”
- Add the path to the bin directory of where Java is installed on your hard drive. It should probably be: C:\Program Files\Java\jdk1.6.0_20\bin unless you changed it during installation.
- Click OK
For Linux and UNIX
One way to set your path in Linux/Unix is to add a path export to your bash profile.
- In order to do this, first open your bash profile in a text editor. For example,
- Then add this line:
Note that the path to the java directory “/usr/local/jdk/bin” may be different on your machine.
- Restart your shell.
In this Tutorial i will use Netbeans on windows PC.
Click the link below on how to install netbeans