Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Jenkins Error: Running two Java Versions – Jenkins Problem in Mac OS

Hi Everyone – Today we are going to discuss about how to have two version of Java Development Kit running in MAC OS and how to switch between them.

This problem statement came when I was playing around with Jenkins setup – As we all Jenkins still demands Java 1.8 ! and not higher . Problem started as I had Java 1.13 as globally installed. Which in turn is not supported by Jenkins Latest version as of Feb 2020.

So when I did something like java -v on cmd , got below response:

Then as all I thought no worries let me install the Java 1.8 and day will be saved, so for that I ran this :

brew cask install adoptopenjdk/openjdk/adoptopenjdk8

I’m installing Java via brew – which I personally believe is easiest way to install Java on mac – brew is a package manager for Mac OS like Chocolatey for Windows.

Which resulted in something like this :

Now after this step if you will try – doing java -v still you will not be able to get java 1.8 as default environment.

So What else we have to do ? Let’s explore that !

First we will list – all the java version installed on machine by :

/usr/libexec/java_home -V

We can see I have two versions now.

Lets make 1.8 as default version by running :

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`Code language: JavaScript (javascript)

In above command I’m pointing JAVA_HOME to 1.8 version explicitly.

Lets run java -version again !

Caution – Java 1.8 does not support short hand for version i.e -v instead you have to type : java -version full command to get the output.

Gaurav Bajpai

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
MotoShare.in offers unparalleled convenience and affordability in bike rentals, allowing users to enjoy hassle-free rides for commuting, exploring, or leisure trips. With a wide range of bikes and scooters, it’s your trusted partner for all two-wheeler needs.

Related Posts

What is Jenkins and use cases of Jenkins?

What is Jenkins? Jenkins is an open-source automation server widely used for building, testing, and deploying software projects. It provides a platform for continuous integration and continuous…

Read More

Jenkins Tutorials: Installing Jenkins on Tomcat

We are going to discuss Installing Jenkins today. We will be focusing on installing it on Tomcat server as a servlet, and tomcat will act as a…

Read More

Jenkins Tutorials: Install Jenkins as Docker Container

In the Previous Post we Learned How to install Jenkins as Servlet on Tomcat server. In this post we will try even simple and easy way to…

Read More

Top Jenkins interview questions and answers

1. What is Jenkins? Jenkins is an open-source automation server that helps automate various aspects of software development, such as building, testing, and deploying code. It allows…

Read More

What is Java and use cases of Java?

What is Java? Java is a high-level programming language originally developed by Sun Microsystems, now owned by Oracle Corporation. It is designed for creating applications that run…

Read More

How to Implement GitOps Using Jenkins?

Hello there, fellow tech enthusiasts! In this blog post, we are going to delve into the world of GitOps and learn how to implement it using Jenkins….

Read More