How to find Java installed by yum_ Detailed explanation of home environment variables

preface

Many programs that need javac in development depend on Java_ Home environment variable

If you manually download the source code and install the JDK, it's easy to know Java_ Home directory for example

Then the corresponding Java_ Home is / usr / local / jdk1 8.0_ seventy-four

The JDK installed by Yum does not need to be configured with path, because it has been done automatically with soft connection.

1. Yum installs JDK

1.1 find available jdks

Then you can see an output like the following (omitting part...):

Install jdk1 as required 7 or jdk1 8. Currently, 1.8 is very stable. Jdk1 is recommended eight

1.2 installing JDK

Install jdk1 The command of 7 is as follows:

Install jdk1 The command of 8 is as follows:

2. Find jdk1 7 Java_ HOME

2.1 find javac:

As you can see, / usr / bin / javac. Generally speaking, / usr / bin adds the path by default, so it can be executed directly

Then track all the way to see where the soft connection points (ll is the shortcut command of LS - L):

Then continue:

JDK1. 7 it looks like this:

Continue:

It is no longer a soft connection. Combined with this address, you can analyze it, Java_ The value of home should be / usr / lib / JVM / java-1.7 0-openjdk. x86_ 64。

Of course, just use this address!

If you continue to view in the next step, you can see the specific version number:

Use the following command to see the real directory, but generally do not use the following specific version number. Upgrading may cause problems.

The specific contents are similar to the following:

2.2 Java_ Add environment variable to home:

Of course, export is only temporary. Not after the next restart.

Can be added to RC files, such as / etc / RC d/rc. Local.

Of course, you can use VIM editing or echo > > command

In this way, it is generally set.

3. Find jdk1 8 Java_ HOME

3.1 find javac:

You can see where the soft connection points (ll is the shortcut command of LS - L):

Then continue:

JDK1. 8 roughly like this:

Continue:

It is no longer a soft connection. Combined with this address, you can analyze it, Java_ The value of home should be / usr / lib / JVM / java-1.8 0-openjdk-1.8. 0.102-1. b14. el7_ 2.x86_ 64。

Just use this address!

If you continue to the next step:

The specific contents are similar to the following:

3.2 view soft connection:

View the JVM Directory:

You can see many soft connections:

Like this, regardless of the beginning of JRE, you can see / etc / alternatives / Java_ sdk_ 1.8. 0 such directory;

Execution:

Then I found that this pile of links point to the Java above_ Home path:

Therefore, you can use one of them as Java_ The value of the home environment variable.

Note: since it is installed, it will not change frequently on the server If there is any change, find and correct it.

3.3 Java_ Add environment variable to home:

Of course, or the echo > > command

In this way, it is generally set.

Finally, if Java is set in Java_ Invalid home. Please refer to: https://www.oudahe.com/p/40178/

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>