Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Fedora25 install Oracle JDK

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

When configuring the Oracle JDK development environment, many web tutorials recommend adding environment variables to / etc/profile. However, the virtual terminal gnome-terminal under Fedora does not log in to Shell by default (which can be modified in the configuration) and does not read the configuration file, resulting in the system unable to find JDK.

Now that the oracle-jdk installation package has been added to the community source, the required configuration is greatly simplified.

$sudo dnf install oracle-jdk8 oracle-jdk7

When the package is installed, download JDK from Oracle's official website.

After installation, there are two ways to configure.

Read environment variable configuration file

/ etc/sysconfig/oracle-jdk is a JDK environment variable configuration file, and multiple JDK versions can be added to facilitate switching.

This method is suitable for single-user systems or ordinary users without modifying system configuration files.

Simply add the following command to ~ / .bashrc or ~ / .bash_profile:

# JDK variablestest-f / etc/sysconfig/oracle-jdk & &. / etc/sysconfig/oracle-jdk | |:

The official wiki recommends adding a user-customized environment variable to ~ / .bash_profile, which is loaded only when you start an interactive login Shell.

If you add environment variables to ~ / .bashrc, each time you open a virtual terminal, the configuration is loaded because all interactive Shell loads ~ / .bashrc.

/ etc/sysconfig/oracle-jdk has been restricted, writing ~ / .bashrc will not cause repeated definition of environment variables, resulting in the problem of variable nesting.

Alternatives mechanism

Using alternatives, you can modify the system-level default JDK. This method does not need to set environment variables, but requires root permission, which is more suitable for system global modification.

$sudo alternatives-- config javac # switch jdk* 1 / usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-15.b17.fc23.x86_64/bin/javac + 2 / usr/lib/jvm/jdk1.8.0_66/bin/javac 3 / usr/lib/jvm/jdk1.7.0_80/bin/javac$ sudo alternatives-- config java # switch jre* 1 / usr/lib/jvm/ Java-1.8.0-openjdk-1.8.0.65-15.b17.fc23.x86_64/jre/bin/java + 2 / usr/lib/jvm/jdk1.8.0_66/jre/bin/java 3 / usr/lib/jvm/jdk1.7.0_80/jre/bin/java

Reference address: https://github.com/FZUG/repo/wiki/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report