[Linux has been resolved] Run java -version error in Ubuntu: The program 'java' can be found in the following packages:

introduce

This is the journey of the editor's growth path, and also the editor's learning path. Hope to grow up with you guys!

Here are two of my favorite quotes:

To have the most simple life and the most distant dream, even if it will be cold tomorrow, the mountains will be high and the water will be far away, and the road will be far away.

Why should one work hard? The best answer I have ever seen is: because the things I like are expensive, the places I want to go are far away, and the person I love is perfect. Therefore, the editor would like to say: encourage each other!

Table of contents

Problem Description:

The translation is as follows:

problem causes:

Solution:


Problem Description:

 

The program 'java' can be found in the following packages:
 * default-jre
 * gcj-5-jre-headless
 * openjdk-8-jre-headless
 * gcj-4.8-jre-headless
 * gcj-4.9-jre-headless
 * openjdk-9-jre-headless
Try: apt install <selected package>


The translation is as follows:

The program "java" can be found in the following packages:
 * default-jre
 * GCJ-5-JRE-headless
 * openjdk-8-jre-headless
 * GCJ-4.8-JRE-headless
 * GCJ-4.9-JRE-headless headless
 * openjdk-9-jre-headless
try: apt install <selected packages>


problem causes:

1) It may be that the java environment variables are not configured properly, check JAVA_HOME, JRE_HOME, CLASSPATH, PATH

2) Did not download jdk

Solution:

Open the vim ~/.bashrc file and add the following configuration at the end

#set oracle jdk environment
export JAVA_HOME=/usr/local/jdk1.8.0_371  ## 这里要注意目录要换成自己解压的jdk 目录
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH 

 Then enter java -version to see if the above problem still occurs

If you have not downloaded jdk, you can read other articles of the editor

[Linux] Download jdk and uninstall oraclejdk_determine ZandR blog in Ubuntu - CSDN blog icon-default.png?t=N3I4https://blog.csdn.net/weixin_60387745/article/details/130736955?spm=1001.2014.3001.5502

The above is the content of the editor's practice, I hope it can help everyone, thank you for watching! !

Guess you like

Origin blog.csdn.net/weixin_60387745/article/details/130725495