LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-29-2018, 09:50 PM   #1
asliyanage1984
LQ Newbie
 
Registered: Oct 2017
Posts: 10

Rep: Reputation: Disabled
How to change the JDK version in the redhat


I have installed redhat 6.6 server version.It default comes with openjdk. I have install java 1.8. So how to update the JAVA_HOME to 1.8 ?

I tried checking .bashrc file in the root folder, there is no JAVA_HOME setting now.

below are the details when i try to use "java -version"

java version "1.6"
OpenJDK Runtime Environment
OpenJDK 64-Bit Server VM (build xxxxxxxxx, mixed mode)

Last edited by asliyanage1984; 05-29-2018 at 10:53 PM.
 
Old 05-30-2018, 12:47 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,167
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
I tried checking .bashrc file in the root folder, there is no JAVA_HOME setting now.
You can edit ~/.profile and use:
Code:
export PATH=/path/to/jdk1.8/bin:$PATH
## If you also want to define a JAVA_HOME add this##
export JAVA_HOME=/path/to/jdk1.8
Regards
 
Old 05-30-2018, 01:01 AM   #3
asliyanage1984
LQ Newbie
 
Registered: Oct 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
I can't fine .profile file in the / folder.
 
Old 05-30-2018, 02:13 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,167
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
Originally Posted by asliyanage1984 View Post
I can't fine .profile file in the / folder.
Do note that it's "~/" (your homedir), not "/" (the root directory). If the file doesn't exist, you can create it, or you can use .bash_profile or .bashrc (whatever file exists).
Also note that you need to logout and login back again for the changes to take effect.
 
Old 05-30-2018, 02:30 AM   #5
asliyanage1984
LQ Newbie
 
Registered: Oct 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks,
anyway i found that i can use "alternatives" in the redhat for set the JAVA_HOME as below link. is it same as what you mention above?

https://access.redhat.com/documentat...ring_Java.html

Last edited by asliyanage1984; 05-30-2018 at 02:47 AM.
 
1 members found this post helpful.
  


Reply



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
how do I set the java version to the version that I've just installed(Jdk) iansu Linux - Newbie 6 07-09-2011 04:03 PM
Where to get JDK 1.5.0_08 and JDK 1.6.0_10 for Linux Redhat Itanium servers java_ascii Linux - Software 1 09-22-2009 11:17 AM
Installing JDK 6 version 14 with yum rasaan Linux - Software 4 07-20-2009 10:55 AM
Missing / Bad Version JDK 1.2 christer Linux - Software 2 10-16-2003 01:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 05:23 AM.

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
Open Source Consulting | Domain Registration