Solved

java home path in linux

Posted on 2014-12-15
12
308 Views
Last Modified: 2014-12-24
Hi

I have installed rhel7 and java-1.7.0-oracle , below details
find / -name "java"
/etc/alternatives/java
/etc/pki/java
/etc/pki/ca-trust/extracted/java
/etc/java
/var/lib/alternatives/java
/usr/bin/java
/usr/lib/jvm-exports/java
/usr/lib/jvm/java-1.7.0-oracle-1.7.0.72-1jpp.2.el7.x86_64/jre/bin/java
/usr/lib/jvm/java-1.7.0-oracle-1.7.0.72-1jpp.2.el7.x86_64/bin/java
/usr/lib/jvm/java
/usr/lib/java
/usr/share/swig/2.0.10/java
/usr/share/java
[root@crm1 opt]#
------------------
please suggest  how to set JAVA_HOME and export path by considering the above details, also how to test it is working
export JAVA_HOME=
export PATH=

thanks in advance
0
Comment
Question by:D_wathi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 35

Assisted Solution

by:Seth Simmons
Seth Simmons earned 250 total points
ID: 40500563
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-oracle-1.7.0.72-1jpp.2.el7.x86_64/
export PATH=$PATH:/usr/lib/jvm/java-1.7.0-oracle-1.7.0.72-1jpp.2.el7.x86_64/

see if that works for you
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40500707
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-oracle-1.7.0.72-1jpp.2.el7.x86_64
export PATH=${PATH}:${JAVA_HOME)/bin

Test: java -version
0
 
LVL 62

Expert Comment

by:gheist
ID: 40501055
Do not export anything. update-alternatives java
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 86

Expert Comment

by:CEHJ
ID: 40501107
Do not export anything. update-alternatives java
But that won't set JAVA_HOME for you

First and second answers fine. Second marginally better (apart from the typo ;)) as variables more portable. But this is better as it avoids problems from Java (unwittingly) already being present in PATH

export PATH=${JAVA_HOME}/bin:${PATH}

Open in new window

0
 
LVL 62

Accepted Solution

by:
gheist earned 250 total points
ID: 40501144
You do not have to set JAVA_HOME unless always up-to-date /usr/bin/java is too good for you (Oracle upgrades java every three months declaring all previous versions unsupported)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40501148
Some software requires JAVA_HOME be set. Presumably D_wathi has a reason for wishing to set it ..?
0
 

Author Comment

by:D_wathi
ID: 40501695
Thanks for all, can you please help in suggesting how to check it is working after setting JAVA_HOME and set path.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40501718
echo $PATH
echo $JAVA_HOME

Open in new window


(In a new terminal)
0
 
LVL 35

Expert Comment

by:Seth Simmons
ID: 40501814
depending on your setup, a new terminal window may not have it
i usually put that in /etc/profile but you can put for individual user profile then logout and login again

then do which java and it will show the path to the binary
you can also do java -version
0
 
LVL 62

Expert Comment

by:gheist
ID: 40502052
Since single version of java is installed, I wonder which java application is incapable of finding it
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 40502199
which java

Open in new window

of course can be independent of $JAVA_HOME (which is part of the point of that variable) so to make sure you have got things set up in the way you want, the following should work and return the correct version

$JAVA_HOME/bin/java -version

Open in new window

0
 
LVL 62

Expert Comment

by:gheist
ID: 40516547
Just for reference:
update-alternatives --list
update-alternatives --config java\*
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question