Set JAVA_HOME :
echo "JAVA_HOME=/etc/alternatives/jre" >> ~/.profile
source ~/.profile
echo $JAVA_HOME
Answer from Karima Rafes on Stack Overflow Top answer 1 of 7
9
Set JAVA_HOME :
echo "JAVA_HOME=/etc/alternatives/jre" >> ~/.profile
source ~/.profile
echo $JAVA_HOME
2 of 7
5
I suggest create an alias command, modifying bashrc and set JAVA_HOME
into bash_profile, this:
Create command in the bashrc:
alias set-java='sudo alternatives --config java;export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::");source ~/.bash_profile'
Save and execute: source ~/.bashrc
Create generic
JAVA_HOMEin bash_profile:export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") PATH=$JAVA_HOME/bin:$PATHExecute the alias command
Medium
computingpost.medium.com › set-java-home-on-centos-rhel-fedora-afa5842e46ef
Set JAVA_HOME on CentOS / RHEL / Fedora | by ComputingPost | Medium
October 21, 2022 - I’ve seen many questions on how to set JAVA_HOME on CentOS / Fedora / RHEL Linux distributions. JAVA_HOME is used to set the path of Java installation on a Linux or Windows system. JAVA_HOME is just a convention and it is usually used by Java EE and Tomcat servers and build tools such as Gradle, Ant and Maven to find where Java is installed.
environment variables - How to set Oracle Java's JAVA_HOME in Fedora 19 - Unix & Linux Stack Exchange
I just installed Fedora 19 and managed to get FedoraUtils installed. So I chose java oracle. after installation I could see in the FedoraUtils list that oracle java (installed) but I can't see the More on unix.stackexchange.com
How do I fix java environment variables in fedora? Thanks in advance.
https://fedoramagazine.org/java-development-on-fedora-linux/ More on reddit.com
linux - Fedora OpenJDK Set JAVA_HOME - Stack Overflow
I am using Fedora(actually Pidora since I am trying to set up hadoop on a cluster of raspberrypi). I installed oopenjdk on all of the nodes using ansible. However, when I tried to set up the JAVA_HOME environment variable, I got really confused looking at the folder of /usr/lib/jvm: More on stackoverflow.com
fedora - How to install jdk1.8 and set its path on fedora28? - Unix & Linux Stack Exchange
To have all the binaries in /home/myuser/programs/jdk1.8.0_161/bin available use · export JAVA_HOME=/home/myuser/programs/jdk1.8.0_161 export PATH=$JAVA_HOME/bin:$PATH · This sets the environment variable JAVA_HOME to the directory where you extracted all the files and puts all binaries in ... More on unix.stackexchange.com
Videos
01:34
JAVA_HOME environment variable setup in Fedora 34 OS through ...
02:06
Set JAVA_HOME and path for JDK on Linux - YouTube
02:59
Easily Set JAVA_HOME on Linux in Just 2 Minutes! (Step-by-Step ...
10:27
How to set JAVA_HOME in macOS / Linux Permanently - YouTube
06:43
How to installing JAVA and set JAVA_HOME on Linux | Ubuntu 18.04 ...
Reintech
reintech.io › blog › installing-java-setting-java-home-fedora-38
Installing Java and Setting JAVA_HOME on Fedora 38
January 31, 2024 - Many Java-based tools—Maven, Gradle, Tomcat, IntelliJ IDEA—use this environment variable to locate the Java installation directory. Without it properly set, you'll encounter build failures and runtime errors that can be frustrating to debug. Think of JAVA_HOME as a contract between your system and Java applications: "Here's where Java lives, and this is the version I want you to use." Fedora ships with OpenJDK in its default repositories, which means you get security updates automatically through your system's package manager.
Alejandro
alejandro.bio › node › 83
How to install Java JDK and set JAVA_HOME in Fedora | Alejandro Bernal Collazos
2. In order to set the JAVA_HOME please execute this command ( normally, java JDK will be placed into this path : /usr/lib/jvm/java ) [user@machine ~]# export JAVA_HOME=/usr/lib/jvm/java · fedora · linux · java · About me · Profession · Experience · Formal Education ·
YouTube
youtube.com › amit kumar
Java development - Set up JAVA_HOME in fedora or ubuntu linux - YouTube
This demo for setting up JAVA_HOME system variable on Fedora-26 linux, exactly the same applies to Ubuntu linux as well.
Published August 6, 2017 Views 1K
Reddit
reddit.com › r/fedora › how do i fix java environment variables in fedora? thanks in advance.
r/Fedora on Reddit: How do I fix java environment variables in fedora? Thanks in advance.
September 23, 2021 - When I had this, I just went ahead and ran a java program anyways and after that it automatically filled in my system jdk. ... vim /etc/profile . Prepend sudo if logged in as not-privileged user, ie. sudo vim. Press 'i' to get in insert mode ... logout and login again, reboot, or use source /etc/profile to apply changes immediately in your current shell ... An unofficial general interest community for the Fedora Project, Fedora Linux, and its associated software. ... Setting up Fedora 32 to use the latest Java version in development environments.
Top answer 1 of 3
9
You can add in your .bashrc file:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
and it will dynamically change when you update your packages.
2 of 3
1
Best solution tested with Fedora 26 :
echo "JAVA_HOME=/etc/alternatives/jre" >> ~/.profile
source ~/.profile
echo $JAVA_HOME
LYRASIS Wiki
wiki.lyrasis.org › display › FEDORA38 › Setting+JAVA_HOME+in+Windows
Setting JAVA_HOME in Windows - Fedora 3.8 Documentation - LYRASIS Wiki
Enter the variable name as JAVA_HOME. Enter the variable value as the installation path for the Java Development Kit. Click 'OK'. Click 'Apply Changes'. If you are running the Fedora Repository as a WAR rather than the Standalone, you may need to restart your application server.
Java67
java67.com › 2016 › 06 › how-to-set-javahome-and-path-in-linux.html
How to set JAVA_HOME and PATH in Linux? Example | Java67
Java developers like me always set mandatory environment variables like JAVA_HOME, PATH, and CLASSPATH on the login scripts executed by the shell when you log in to Linux like bash_profile.sh, but you can also set JAVA_HOME into /etc/profile for all users. I'll show you steps on how to find the location of Java and how to set up the JAVA_HOME in Linux in this article, and these steps should also work with any Linux or Java version like Ubuntu, RedHat, CentOS, SUSE, ArchLinux, Debian, Fedora, etc.
LYRASIS Wiki
wiki.lyrasis.org › display › FEDORA34 › Setting+JAVA_HOME+in+Windows
Setting JAVA_HOME in Windows - Fedora 3.4 Documentation - LYRASIS Wiki
Enter the variable name as JAVA_HOME. Enter the variable value as the installation path for the Java Development Kit. Click 'OK'. Click 'Apply Changes'. If you are running the Fedora Repository as a WAR rather than the Standalone, you may need to restart your application server.
FedoraForum
fedoraforum.org › forum › showpost.php
Setting Java PATH in Linux
If you installed your "another version" and then right away ran "locate javac | grep bin" you would not see any hint of your new java installation in the locate output (unless you just happened to run your command by chance right after the cron job runs that updates the locate DB, it does that in Fedora very early in the morning). You can run this as root user to force the update: ... JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 (or whatever arch you used as the extension) export JAVA_HOME and then logout the GUI and log back in and also use the alternatives --config java command to also point to the new java and then confirm it's correct afterwards by running:
nixCraft
cyberciti.biz › nixcraft › howto › bash shell › how to set java_home / path variables under linux bash profile
How to Set JAVA_HOME / PATH variables Under Linux Bash Profile - nixCraft
May 25, 2012 - 1) In my case I did all you said for .bash_profile, however, running which java still shows old java path (crappy java that comes with linux fedora 7) 2) I tried the same to set /etc/profile but I believe you provided wrong sintax · Could somebody provide correct sintax for seting java path in /etc/profile or whatever as long as my which java will show my newest java? ... I have read lots of user posting at various pages and none of them would work. Finally, I found a way to do this correctly and hope this will help to some of you. ... echo ‘export JAVA_HOME=/opt/jdk1.5.0_12’ > /etc/profile.d/jdk.sh echo ‘export PATH=$JAVA_HOME/bin:$PATH’ >> /etc/profile.d/jdk.sh
CodingTechRoom
codingtechroom.com › question › -set-java-home-openjdk-fedora
How to Set JAVA_HOME for OpenJDK on Fedora - CodingTechRoom
Open a terminal window on your Fedora system. Edit the .bash_profile or .bashrc file in your home directory. Add or modify the JAVA_HOME variable to point to your OpenJDK directory. Source the file or restart the terminal to apply changes. Mistake: Setting JAVA_HOME to the wrong path.