Install Java

In this article let us learn about installing Java and how to get the development environment ready for Java programming.

To prepare the Java development environment, you need to do the following steps:

  1. Download Java
  2. Install Java
  3. Setup Path
  4. Test installation

1. Download Java

Download a JDK to write Java programs. There are different flavors of Java. Then you java JRE, JDK etc. Enough to confuse a beginner. To start with Java programming, you need to download Java SE.

The above given link is the page that gives the latest Java SE for download. It is free. Generally in that download page you will see two options at the top. Java Platform (JDK) and NetBeans with JDK. NetBeans is an integrated development environment (IDE) for Java.

To learn Java, I recommend you to start with simple text editor like Notepad++. Windows notepad is too simple and so do not use that please. If you are a Linux based person, you can start with Vim. Download Notepad++ (its free) and install it. This is the editor using which we will write Java programs. 

Now coming back to Java download. Download the Java Platform JDK (without NetBeans). So we will be using the latest version of Java SE, means Java "Standard Edition".

2. Install Java

If you are on Windows, Java installation is a standard step by step (click next) process. It will present you different options and by default what ever is selected is good to go. Just click next, next and follow the steps, it is a simple and straightforward task to accomplish.

3. Setup Path

It is essential to have a global path defined in the OS environment. So that it will give us the luxury of compiling and executing a Java program from any path in the system. In Windows,

  1. Go to My computer and select properties, advanced system settings then in System Properties
  2. Go to 'Advanced' and click 'Environment Variables'

Add the PATH variable with value pointing to the install location of the JDK. Refer the image below:

Java Setup Path

4. Test Installation

To test if the installation is right, open a command prompt and type the command "javac -version". It should respond with the version of the JDK installed. Then you are ready to start writing Java programs.

Exception Occured:

Messageerror_log(app.log): Failed to open stream: Permission denied
Trace#0 (): log_error(2, 'error_log(app.log): Failed to open stream: Permission denied', '/home/dh_czz6eb/', 36)
#1 /home/dh_czz6eb/ error_log('18-06-2024 07:57:16 am (IST),/home/dh_czz6eb/,193,0,ErrorException,Optional parameter $per_page declared before required parameter $href is implicitly treated as a required parameter,/java/install-java.html,#0 /home/dh_czz6eb/ log_error(8192, 'Optional parame...', '/home/dh_czz6eb...', 193)
#1 [internal function]: check_for_fatal()
#2 {main}
', 3, 'app.log')
#2 /home/dh_czz6eb/ log_exception(ErrorException)
#3 /home/dh_czz6eb/ log_error(8192, 'Optional parameter $per_page declared before required parameter $href is implicitly treated as a required parameter', '/home/dh_czz6eb/', 193)
#4 (): check_for_fatal()