NB JAVA HOME should point to a JDK not a JRE The JAVA HOME environment variable is not defined correctly

0 votes

Hi Guys,

I have configured Maven in Jenkins. But it is showing me the below error when I tried to run any job.

[maven] $ /maven/bin/mvn -f pom.xml clean package
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

How can I solve this error?

Jun 4, 2020 in DevOps & Agile by akhtar
• 38,260 points
19,154 views

1 answer to this question.

0 votes

Hi@akhtar,

You may get this error if you didn't set your java path in .bashrc file. First try to check Maven version using the below given command.

[root@localhost ~]# mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /maven
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_221-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.18.0-80.el8.x86_64", arch: "amd64", family: "unix"

You can see java home in your output. Copy the path till /usr/java/jdk1.8.0_221-amd64 and set this path in .bashrc file.

JAVA_HOME=/usr/java/jdk1.8.0_221-amd64

Hope it helps!!

If you need to know more about Java, join our Java certification course online.

Thank you

answered Jun 4, 2020 by MD
• 95,460 points

Related Questions In DevOps & Agile

+13 votes
2 answers
0 votes
0 answers

which of the following is not a devops tools?

Which of the following is Not a ...READ MORE

Dec 22, 2022 in DevOps & Agile by Edureka
• 13,620 points
723 views
+1 vote
2 answers

is it possible to assign a Feature/User Story/Task to a team [Group] in VSTS

In most cases, we would break Work ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,220 points
5,438 views
+3 votes
2 answers
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,041 views
+2 votes
1 answer
0 votes
1 answer

How to get the file count in amazon bucket linux cli

Hi@Shahzeb, You can do this task using the ...READ MORE

answered Apr 27, 2020 in DevOps & Agile by MD
• 95,460 points
3,702 views
+2 votes
1 answer

Error: You might need to start Docker for Windows. How do i start the daemon?

Hi, If you are running containers with Docker, ...READ MORE

answered May 19, 2020 in DevOps & Agile by MD
• 95,460 points
8,075 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP