Setting JAVA_HOME in linux

0 votes

I am trying to set path for JAVA_HOME in my linux machine. When I run java -version it shows:

  • java version "1.7.0_55"
  • OpenJDK Runtime Environment (rhel-2.4.7.1.el6_5-x86_64 u55-b13)
  • OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)

I'm trying to build my maven project, but this comes up:

Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/java/jdk1.7.0_05/bin/java

Please tell what to do here. I am lost.

May 24 in Linux Administration by shubham
• 6,650 points
18 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
  1. find /usr/lib/jvm/java-1.x.x-openjdk
  2. vim /etc/profile

    Prepend sudo if logged in as not-privileged user, ie. sudo vim

  3. Press 'i' to get in insert mode
  4. add:

    export JAVA_HOME="path that you found"
    
    export PATH=$JAVA_HOME/bin:$PATH
  5. Reboot your system, and voila
answered May 24 by DareDev
• 6,710 points

Related Questions In Linux Administration

0 votes
1 answer

Setting environment variables in linux

You need to add more information about ...READ MORE

answered May 13 in Linux Administration by ajs3033
• 7,120 points
14 views
0 votes
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3 in Linux Administration by Omkar
• 67,000 points
60 views
0 votes
1 answer

How to create a symlink in Linux?

To create a symbolic link, you can ...READ MORE

answered Jan 31 in Linux Administration by Omkar
• 67,000 points
44 views
0 votes
1 answer

generating a list of files with their absolute path in Linux

If you find an absolute path to start with, ...READ MORE

answered May 16 in Linux Administration by Upasana
• 8,210 points
21 views
0 votes
1 answer
0 votes
2 answers

Java Environment Variables

--- To set java path --- There are ...READ MORE

answered Dec 3, 2018 in Java by Sushmita
• 6,840 points
55 views
0 votes
1 answer

Serverspec doesn't check package version correctly

Specinfra is escaping the characters in the with_version chain ...READ MORE

answered Aug 2, 2018 in DevOps Tools by Kalgi
• 36,920 points
46 views
0 votes
1 answer

How do I set variable if a specific package version is installed in CFEngine?

Here is what you can do.Just use packagesmatching to ...READ MORE

answered Jul 12, 2018 in Other DevOps Questions by Atul
• 10,220 points
63 views
0 votes
1 answer

Finding pat of afile in linux

You can use readlink command: readlink -f filename.txt for ...READ MORE

answered Mar 15 in Linux Administration by DareDev
• 6,710 points
11 views
0 votes
1 answer

How to find the group associated with a user in linux?

To list all the groups groups or to list ...READ MORE

answered 6 days ago in Linux Administration by DareDev
• 6,710 points
8 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.