- Spring MVC:Beginner's Guide(Second Edition)
- Amuthan Ganeshan
- 665字
- 2021-07-14 10:49:43
Setting up Java
Obviously, the first thing that we need to do is to install Java. The more technical name for Java is Java Development Kit (JDK). JDK includes a Java compiler (javac), a Java virtual machine, and a variety of other tools to compile and run Java programs.
Time for action - installing JDK
We are going to use Java 8, which is the latest and greatest version of Java, but Java 6 or any higher version is also sufficient to complete this chapter, but I strongly recommend you use Java 8 since in later chapters of this book we may use some of the Java 8 features such as, streams and lambda expressions. Let's take a look at how we can install JDK on a Windows operating system:
- Go to the Java SE download page on the Oracle website at http://www.oracle.com/technetwork/java/javase/downloads/index.html.
- Click on the Java Platform (JDK) 8u91/8u92 download link; this will take you to the license agreement page. Accept the license agreement by selecting the radio button option.
- Now, click on the listed download link that corresponds to your Windows operating system architecture; for instance, if your operating system is of type 32 bit, click on the download link that corresponds to Windows x86. If your operating system is of type 64 bit, click on the download link that corresponds to Windows x64.
- Now it will start downloading the installer. Once the download is finished, go to the downloaded directory and double-click on the installer. This will open up a wizard window. Just click through the next buttons in the wizard, leaving the default options alone, and click on the Close button at the end of the wizard:
JDK installation wizard
Tip
Additionally, a separate wizard also prompts you to install Java Runtime Environment (JRE). Go through that wizard as well to install JRE in your system.
- Now you can see the installed JDK directory in the default location; in our case, the default location is
C:\Program Files\Java\jdk1.8.0_60
.
Time for action - setting up environment variables
After installing JDK, we still need to perform some more configurations to use Java conveniently from any directory on our computer. By setting up the environment variables for Java in the Windows operating system, we can make the Java compiler and tools accessible from anywhere in the file system:
- Navigate to Start Menu | Settings | System | About | System info | Advanced system settings.
- A System Properties window will appear; in this window, select the Advanced tab and click on the Environment Variables button to open the Environment Variables window.
- Now, click on the New button in the System variables panel and enter
JAVA_HOME
as the variable name and enter the installed JDK directory path as the variable value; in our case, this would beC:\Program Files\Java\jdk1.8.0_91
. If you do not have proper rights for the operating system, you will not be able to edit System variables; in that case, you can create theJAVA_HOME
variable under the User variables panel. - Now, in the same System variables panel, double-click on the path variable entry; an Edit System Variable window will appear.
- Edit Variable value of Path by clicking the new button and enter the following text
%JAVA_HOME%\bin
as the value.If you are using a Windows operating system prior to version 10, edit the path variable carefully; you should only append the text at the end of an existing path value. Don't delete or disturb the existing values; make sure you haven't missed the
;
(semi-colon) delimited mark as the first letter in the text that you append:Tip
- Now click on the OK button.
Now we have installed JDK in our computer. To verify whether our installation has been carried out correctly, open a new command window, type java -version
, and press Enter; you will see the installed version of Java compiler on the screen:
C:\Users\Amuthan>java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b15, mixed mode)
- OpenStack Cloud Computing Cookbook(Third Edition)
- Data Visualization with D3 4.x Cookbook(Second Edition)
- 網(wǎng)絡(luò)爬蟲原理與實(shí)踐:基于C#語言
- 區(qū)塊鏈底層設(shè)計Java實(shí)戰(zhàn)
- 從零開始學(xué)Linux編程
- Django 3.0入門與實(shí)踐
- OpenMP核心技術(shù)指南
- PrimeFaces Blueprints
- 從Power BI到Analysis Services:企業(yè)級數(shù)據(jù)分析實(shí)戰(zhàn)
- ASP.NET 4.0 Web程序設(shè)計
- Java面試一戰(zhàn)到底(基礎(chǔ)卷)
- 劍指大數(shù)據(jù):企業(yè)級電商數(shù)據(jù)倉庫項目實(shí)戰(zhàn)(精華版)
- Ionic Framework By Example
- Python3從入門到實(shí)戰(zhàn)
- Python從入門到項目實(shí)踐(超值版)