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- 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,890 points

1 answer to this question.

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,810 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,280 points
–1 vote
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
• 68,480 points
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
• 68,480 points
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,570 points
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,880 points
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
• 46,110 points
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,240 points
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,810 points
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 Jun 20 in Linux Administration by DareDev
• 6,810 points