Sunday 1 January 2017

So you want to code in Java! See The Tools you need To get Started


So you want to learn how write Java programs! Well, allow me take you on a little tour round Java and the tools you need to get started.

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
Java is owned by a company called Oracle, so you need to head over to Oracle's website to get the Java Virtual Machine, also known as the Java Run-time Environment (JRE). You can use this link: http://java.com/en/download/index.jsp to download it.
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.

3. Java Software Development Kit (JDK):
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
4. Text Editor:
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
5. Integrated Development Environment (IDE):
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
They handle all the creating and compiling of codes. Behind the scenes, though. It takes your source code and creates the java file, launches Javac and compiles the class file. They run your programme inside them. This saves you the hassle of opening up a terminal window and typing long strings of commands.

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!




Facebook Comment Box

Google Comment Box

0 comments:

Post a Comment