Java is widely used programming language because it is not OS dependent. Which means, we can write a java program on any operating system and we can run the same regardless of operating system. Not unlike it’s predecessors such as C, C++,and Fortran which we are required to create multiple version of our program depending on the target OS. This is made possible because a java program does not execute directly from user’s machine but rather it is interpreted by the Java Virtual Machine or JVM.

The Java Virtual Machine

The Java Virtual Machine

From the illustration above the java source code (.java) is compiled and converted into a bytecode. The bytecode (.class file) is loaded to the java virtual machine and then it is being interpreted to provide useful information to the end user. The Java interpreter handles all the communication to the operating system.

Java Development

First and foremost, you have to select from a wide variety of IDE ranging from netbeans, eclipse, bluej, etc. But of course before jumping into using Integrated Development Environment (IDE), we need to understand first how java program were compiled the traditional way, using the command shell which we will discuss thoroughly later. For personal preference I am using ECLIPSE.

First and foremost you need to grab a copy of Java Development Kit (JDK) from Oracle. Select the appropriate version depending on your operating system.The JDK contains the JAVA API documentation and source codes that is open for public usage.

Compiling of Java Source Code through Command Shell

Make a note that a java source code ends with .java. After creating the java source code, we need to convert it into bytecode(.class) which is the understandable code by the Java Virtual Machine. The following is a simple way to compile a java source code:

javac -source 1.5 Basic.java

First and foremost we need to navigate first on the JDK bin directory. Then execute the javac command. The -source argument refers to which java release you want to compile your java source code. Different usage of Java API requires consideration of version to use in compiling. For instance the use of Scanner API requires java 1.5. The command above is only the basic. So if you are interested in all the different options available in compiling of java program, please refer to table below:

C:\Program Files\Java\jdk1.7.0_17\bin>javac
Usage: javac <options> <source files>

where possible options include:

option Description
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info during compilation
-nowarn No warning will not be generated
-verbose Verbosely output the compilation steps
-deprecation Output source locations where deprecated APIs are used
-classpath Specify where to find user class files and annotation processors
-cp Specify where to find user class files and annotation processors
-sourcepath Specify where to find input source files
-bootclasspath Override location of bootstrap class files
-extdirs Override location of installed extensions
-endorseddirs Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor [,,…] Names of the annotation processors to run; bypasses default discovery process
-processorpath Specify where to find annotation processors
-d Specify where to place generated class files
-s Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding Specify character encoding used by source files
-source Provide source compatibility with specified release
-target Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J Pass directly to the runtime system
-Werror Terminate compilation if warnings occur
@ Read options and filenames from file

Java IDE List

The following are the suggested development tools that you can select depending on your preference

Eclipse -can be downloaded from http://www.eclipse.org/downloads. This is my preferred IDE since it is very robust and lightweight.

Netbeans – Nice looking IDE. It provides useful templates especially in dealing with Java UI application. You can download it in https://netbeans.org/downloads/

Notepad – This is a built in text editor in windows platform which is a preferred editor of old school java developer. Some tutorials are suggesting to use this however for personal preference. It is enough to compile one or two java program using notepad just to get the hang of the basic structure of a java project. However making use of IDE such as eclipse makes a lot more sense because of the intelligent suggestion of classes, formatting and java class structure.