Java is a general-purpose, object-oriented computer programming language that is specifically
designed to have as few implementation dependencies as possible. It was developed to let application developers "write once, run anywhere" codes (WORA), meaning that compiled Java code can run on all platforms (Computer Systems) that support Java without need for recompilation
However, before you begin programming in Java, there are certain tools required. One of the difficult things about getting started is installing everything you need. Even before you write a single line of code, the headaches begin! Hopefully, I have made an outline of requirements so you know how to get started.
1. Computer system (PC/laptop e.t.c.):
Obviously, you need a functional computer system to write, compile and execute your java codes.
2. The Java Virtual Machine (JVM):
Java is platform independent. This means that it can run on just about any operating system. So whether your computer runs Windows, Linux, Mac OS, it's all the same to Java! The reason it can run on any operating system is because of the Java Virtual Machine. The Virtual Machine is a programme that processes all your code correctly. So you need to install this programme (Virtual Machine) before you can run any Java code.
JRE Download page |
You can check to see if you already have the JRE on your computer by clicking the link "Do I have Java?". You'll find this link under the big Download button on the page.
At this stage, you still can't write any programs. The only thing you've done is to install software so that Java programs can be run on your computer. To write code and test it out, you need something called a Software Development Kit (SDK).
You can download Java's Software Development Kit from here: http://www.oracle.com/technetwork/java/index.html
..Installing JDK |
The actual code for your programs can be written in a text editor. Examples of this are the Notepad found on windows OS, Notepad++ and a host of others. The code is called source code, and is saved with the file extension .java and then stored inside a file on a specified location on your computer system's memory.
A programme called Javac is then used to turn the source code into Java Byte Code. This is known as compiling. After Javac has finished compiling the Java Byte Code, it creates a new file with the extension .class. (At least, it does if no errors are detected.) Once the class file has been created, it can be run on the Java Virtual Machine.
Coding using Command Prompt and a Text Editor |
So, summarily:
- Create source code with the extension .java
- Use Javac to create (compile) a file ending in .class
- Run the compiled class
These are third party development environment software that make writing, compiling and execution of codes easier. Examples of this include: Netbeans, Eclipse, DrJava, Code-blocks, e.t.c.
Netbeans |
Now that you have a general idea of how Java works, why not get to work? Please drop any comments or questions in the comment box below!
0 comments:
Post a Comment