Wednesday 26 October 2022

How to Set up java Development Kit in Windows/Linux/MacOS?

 

SDET Interview Question and Answers.  

Jenkins Interview Questions and Answers

Appium Interview Questions and Answers

Selenium Interview Questions and answers

GIT Interview Questions and Answers

Setting up a JDK for Windows/x64

Let us download the Windows version. What you get is a ZIP file of about 200MB that you can open with any ZIP utility software. This ZIP file contains the JDK. You can unzip the content of this file anywhere on your computer.

Once this is done you need to create an environment variable called JAVA_HOME that points to the directory where you unzipped the JDK. First you need to open a DOS prompt. If you unzipped a JDK 16 ZIP file in the D:\jdk\ directory then the command you need to type in this DOS prompt is the following:

> set JAVA_HOME=D:\jdk\jdk-16

Please note that in this example and all the others the leading > is there to show you that you need to type this command or paste it in a prompt. You should not type this character or paste it as it is not part of the set command.

You can check that the JAVA_HOME variable has been properly set by typing the following code:

> echo %JAVA_HOME%

This command should print the following:

D:\jdk\jdk-18

You then need to update your PATH environment variable to add the bin directory of your JDK directory to it. This can be done with the following command:

> set PATH=%JAVA_HOME%\bin;%PATH%

You need to be very cautious while setting up these two variables, because a single mistake like an added white space of a missing semicolon will result in failure.

Do not close this command prompt. If you close it and open it again then you will need to create these two variables again.

Setting up a JDK for Linux/x64

Let us download the Linux version. What you get is an archive file with a .tar.gz extension that you need to expand.

To expand it, you need to copy it or move it to the right directory. You can then type the following command:

$ tar xzf *.tar.gz

Please note that in this example and all the others, the leading $ is there to show you that you need to type this command or paste it in a prompt. You should not type this character or paste it, as it is not part of the tar command.

This command expands all the files with the extension .tar.gz that you have in the current directory. You can use the exact name of this file if you just need to expand it.

Executing this command may take several seconds or more, depending on your system. It creates a new directory in the current directory with the content of the JDK in it.

Once this is done you need to create an environment variable called JAVA_HOME that points to the directory where you expanded the JDK. If you expanded a JDK 16 archive file in the /home/javauser/jdk directory then the command you need to type in this shell prompt is the following:

$ export JAVA_HOME=/home/javauser/jdk/jdk-18

The exact directory depends on the distribution file you have expanded.

You can check that the JAVA_HOME variable has been properly set by typing the following code:

$ echo $JAVA_HOME

This command should print the following:

/home/javauser/jdk/jdk-18

Then you need to update your PATH variable to add the bin directory of your JDK directory to it. This can be done with the following command:

$ export PATH=$JAVA_HOME/bin:$PATH

You need to be very cautious while setting up these two variables because a single mistake like an added white space of a missing semicolon will result in failure.

Do not close this shell prompt. If you close it and open it again then you will need to create these two variables again.

You can check if everything is ok by typing the following command:

$ which java

Your shell should print the complete path to the java executable file in the bin directory of the distribution you just expanded. In this example it will print:

/home/javauser/jdk/jdk-18/bin/java

Setting up a JDK for macOS

Let us download the macOS version. What you get is an archive file with a .tar.gz extension that you need to expand.

To expand it, you need to copy it or move it to the right directory. You can then type the following command:

$ tar xzf *.tar.gz

Please note that in this example, and all the others, the leading $ is there to show you that you need to type this command or paste it in a prompt. You should not type this character or paste it as it is not part of the tar command.

This command expands all the files with the extension .tar.gz that you have in the current directory. You can use the exact name of this file if you just need to expand it.

Executing this command may take several seconds or more, depending on your system. It creates a new directory in the current directory with the content of the JDK in it. This directory has the extension .jdk.

Once this is done you need to create an environment variable called JAVA_HOME that points to the directory where you expanded the JDK. If you expanded a JDK 16 archive file in the /Users/javauser/jdk directory then the command you need to type in this shell prompt is the following:

$ export JAVA_HOME=/Users/javauser/jdk/jdk-18.jdk/Contents/Home

The exact directory depends on the distribution file you have expanded.

You can check that the JAVA_HOME variable has been properly set by typing the following code:

$ echo $JAVA_HOME

This command should print the following:

/Users/javauser/jdk/jdk-18.jdk/Contents/Home

You then need to update your PATH variable to add the bin directory of your JDK directory to it. This can be done with the following command:

$ export PATH=$JAVA_HOME/bin:$PATH

You need to be very cautious while setting up these two variables because a single mistake like an added white space of a missing semicolon will result in failure.

Do not close this shell prompt. If you close it and open it again then you will need to create these two variables again.

You can check if everything is ok by typing the following command:

$ which java

Your shell should print the complete path to the java executable file in the bin directory of the distribution you just expanded. In this example it will print:

/Users/javauser/jdk/jdk-18.jdk/Contents/Home/bin/java

 

Want to understand the PageObjectModel in Selenium with Demo Code and real time examples, then checkout below post:

Page Object Model with Examples

****************************************

TOP 15 BDD - CUCUMBER Interview Q&A


************************************************

✍️AUTHORLinkedIn Profile

************************************************

Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

For more details whatsapp : https://lnkd.in/dnBWDM33

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


 

No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

API Status Codes with examples for QA-Testers

  🔺 LinkedIn: https://www.linkedin.com/in/sidharth-shukla-77b53145/ 🔺 Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 🏮In API testing, it...