简体   繁体   English

Ubuntu未显示Java已安装

[英]Ubuntu not showing java is installed

I downloaded the .tar.gz of from the offical site and extracted it into /opt/java directory and 我从官方网站下载了.tar.gz,并将其解压缩到/opt/java目录中,

$ ls /opt/java

gives

jdk-10.0.1

but when I run 但是当我跑步时

$ java -version

it gives 它给

The program 'java' can be found in the following packages:


* default-jre
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* gcj-5-jre-headless
* gcj-6-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>

Why is not showing the version of java jdk installed? 为什么未显示已安装的Java JDK版本?

that means java is intalled but it doesn't know where... 这意味着安装了Java,但不知道在哪里...

you have to set your JAVA path inside: /etc/profile and must add to that file: 您必须在/ etc / profile中设置JAVA路径,并且必须添加到该文件中:

export JAVA_HOME=<your_java_path>
export PATH=$JAVA_HOME/bin:$PATH 

you have to replace 你必须更换

<your_java_path>

for your known current java path 为您已知的当前Java路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM