no

How to Install Java on Windows

This blog post will list down the steps on how we can install and configure Maven on a Windows machine. 1. Introduction Maven is a project...

This blog post will list down the steps on how we can install and configure Maven on a Windows machine.

1. Introduction

Maven is a project management and a build automation tool used primarily by Java programmers to manage the complete build life cycle of a project. Maven provides the following benefits:

  • It manages the project dependencies in a central local directory, so the project doesn't need to store 3rd party libraries in source control.
  • With Maven, you can add a new dependency quickly.
  • Maven can automatically identify transitive dependencies, download, and include them in the project.
  • Maven can use different plugins to do varying tasks such as generating JavaDoc, packaging the jar file, and more.

2. Installation

2.1 Download Maven from http://maven.apache.org/download.cgi.

2.2 Extract in c:/apache/maven. Make sure to rename the extracted folder apache-maven-3.6.3-bin to just maven.

3. Add MAVEN_HOME Environment Variable

Now we will add MAVEN_HOME Environment Variable. So that we can refer to this folder when we need to use Maven.

3.1 Open your Windows Explorer, right-click on This PC or My Computer and click Properties.

3.2 Click Advanced system settings / Environment Variables / New.
3.3 Enter Variable name=MAVEN_HOME and Variable value=c:\apache\maven.

4. Add Maven in Windows Environment Path

This will make the mvn command in c:/apache/maven/bin, available in the Windows terminal.

4.1 In the same view "Environment Variables", select Path and click Edit.
4.2 Click New, and in the new row enter: “%MAVEN_HOME%\bin”.

5. Verify Installation

5.1 Open a Windows terminal by pressing Windows + r, type "cmd", and press enter.
5.2 In the terminal enter mvn --version and hit enter.







This blog post will list down the steps on how we can install and configure Maven on a Windows machine.

1. Introduction

Java is a computer programming language developed by James Gosling at Sun Microsystems back in 1995 and has since become one of the most popular programming languages. Java is an object-oriented programming language, with syntax largely based on C and C++, which allows the creation of robust, secure, and portable applications that can run on multiple platforms including Windows, Linux, and Mac operating systems. 

It is assumed that 3 billion devices are now running in Java. Java is anywhere from desktops, laptops, mobile devices, Blu-ray players, printers, webcams, navigation systems, medical devices, and more - platform independence. This is why it is still popular, as a program developed on Java can be run on multiple types of computers and devices as long as it has Java Runtime Environment (JRE) installed.

2. Installation

2.1 Download OpenJDK from Redhat's website https://developers.redhat.com/products/openjdk/download.


2.2 Sign in using your Google account.
2.3 Check the terms and conditions and click submit.

2.4 Double click the downloaded installer "java-11-openjdk-11.0.8.10-2.windows.redhat.x86_64.msi". The version might be different, depending on when you download.

2.5 If a Security Warning pop up, click Run.


2.5 Click Next, and check the I accept terms in the license agreement. Click Next.


2.6 Set the directory where you want to install OpenJDK to c:\Java\jdk\openjdk-11. It's important to set aside a directory for Java as you might need to install another version later like openjdk-14. 

*Create c:\Java\jdk if it doesn't exist.


2.7 Click Next, Install, and finally Finish.

3. Add JAVA_HOME Environment Variable

Now we will add JAVA_HOME Environment Variable. So that we can refer to this folder when we need to use Java.

3.1 Open your Windows Explorer, right-click on This PC or My Computer and click Properties.


3.2 Click Advanced system settings / Environment Variables / New.


3.3 Enter Variable name=JAVA_HOME and Variable value=c:\Java\openjdk\openjdk-11. Click Ok.

4. Add Java in Windows Environment Path

This will make the mvn command in c:/java/jdk/openjdk-11/bin, available in the Windows terminal.

4.1 In the same view "Environment Variables", select Path and click Edit.



4.2  Click New, and in the new row enter: “%JAVA_HOME%\bin”.

5. Verify Installation

5.1 Open a Windows terminal by pressing Windows + r, type "cmd", and press enter.


5.2 In the terminal enter :
>java --version and hit enter
>javac --version and hit enter

6. Common Issues

6.1 A Java class is compiled with version x using javac and it is being run on version y using java. Or it could be that the project loaded in an IDE is set on version x, but it is run on version y.

Related

coding 7735016646902018896

Post a Comment Default Comments

item