LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2016, 05:01 PM   #1
Erevna
LQ Newbie
 
Registered: Apr 2016
Posts: 2

Rep: Reputation: Disabled
jdk path in centos7


Hi,
I'm a newbee to linux, I am trying to locate jdk path in my centos7. I have not installed any java on my own though. But I see that when I type, java -version it specifies jdk 1.8.0_65, whereis java gives me lot of path, but if I try to navigate to check there, I can see only skyblue colored java files at /usr/bin/java, and if I'm not wrong its a softlink. I am not able to locate jdk 1.8.0_65 anywhere. I need this exact path to set in my bash_profile.

Thank you in advance.
 
Old 04-16-2016, 05:37 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,814
Blog Entries: 15

Rep: Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661Reputation: 1661
From command line if you run "ls -l /usr/bin/java" it should output something like:
lrwxrwxrwx. 1 root root 22 Feb 22 14:09 /usr/bin/java -> /etc/alternatives/java

The l before the permissions confirms it is a symbolic link as does the arrow pointing to the linked file.

If you then do "ls -l /etc/alternatives/java" it shows you that file is also a symbolic link.
lrwxrwxrwx. 1 root root 72 Feb 22 14:09 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-2.b15.el7_2.x86_64/jre/bin/java

If you then do an ls -l on that file you'll see that is a regular file (i.e. not a link):
-rwxr-xr-x. 1 root root 7336 Jan 15 12:31 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-2.b15.el7_2.x86_64/jre/bin/java

Your full path to that java is therefore:
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-2.b15.el7_2.x86_64/jre/bin/java

Unless you have reason to use a different java there is no reason not to use /usr/bin/java as the path you use.

The first link to /etc/alternatives shows you this is the preferred/default java based on "alteratives" setup. You can have multiple java versions installed and can use one of the others if required. If you do "ls -l /usr/lib/jvm" which is the parent directory of the above path you may see that other Java versions are installed such as a 1.7.x version.

You can also do "rpm -qa |grep -i java" to see which Java packages (RPM = RedHat Package Maager)) have been installed.

If you type "man alternatives" you can learn more about how alternatives works.

If you type "man rpm" you can learn more about that commad.
 
Old 04-29-2016, 04:38 PM   #3
Erevna
LQ Newbie
 
Registered: Apr 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thank you MensaWater. Very neatly explained. Was very useful.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Helping finding path to JDK for eXist kesi Linux - Software 10 03-18-2012 10:14 PM
slackware 13.1 java jdk path problems with netbeans molossus Slackware 7 08-19-2011 07:49 AM
Trying to set classpath and path for my jdk ubuntu10.10 to complie from anywhere V'Lar Programming 2 12-04-2010 02:40 PM
jdk not in correct path angryfirelord Slackware 6 04-08-2007 10:14 AM
adding java jdk to path snecklifter Linux - Newbie 4 11-01-2004 02:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration