[英]The program 'jshell' is currently not installed when trying to run jshell on Ubuntu
I have downloaded and "manually" installed JDK 10 for Linux 64bit edition (for Ubuntu 16.04), Oracle Java SE Development Kit (note: I wanted to download the Java9 JDK but this is no longer supported and I was referred to the Java 10 SE Development kit instead). 我已经下载并“手动”安装了Linux 64位版本的JDK 10(适用于Ubuntu 16.04), Oracle Java SE开发工具包 (注意:我想下载Java9 JDK,但是不再支持该功能,因此我被称为Java 10 SE开发套件)。
When I try running jshell
from a terminal window I get the following error, 当我尝试从终端窗口运行
jshell
,出现以下错误,
The program 'jshell' is currently not installed.
当前未安装程序“ jshell”。 To run 'jshell' please ask your administrator to install the package 'openjdk-9-jdk-headless' You will have to enable the component called 'universe'
要运行“ jshell”,请要求管理员安装软件包“ openjdk-9-jdk-headless”。您将必须启用名为“ universe”的组件
I dont know why the message is asking me to install openjdk when I have installed the classic java version. 我不知道为什么在安装经典Java版本后,该消息要求我安装openjdk。 When I run "which jshell" I dont get any details returned.
当我运行“哪个jshell”时,我没有得到任何详细信息。
Can anyone help me get jshell
installed and working ? 谁能帮助我安装并运行
jshell
?
JShell
is a development tool. JShell
是开发工具。 You should download and install the Java Development Kit to run jshell
, not just the Java Runtime Environment. 您应该下载并安装Java Development Kit来运行
jshell
,而不仅仅是Java Runtime Environment。
I followed the tip given by Ernest Kiwele and others above and set-up my JAVA_HOME partly as described in How to set JAVA_HOME in Linux for all users but also by creating a sh
script in my profile.d directory. 我遵循了Ernest Kiwele等人给出的技巧,并部分地按照如何在Linux中为所有用户设置JAVA_HOME中所述设置了JAVA_HOME,还通过在profile.d目录中创建了一个
sh
脚本来进行设置 。 Thank you for the help. 感谢您的帮助。
I dont feel completely comfortable with my solution since I have configured my Java using update-alternatives
. 由于我已经使用
update-alternatives
配置了Java,因此我对解决方案不完全满意。 I dont know why people advise to use update-alternatives
to set the version of Java to use if the other depending variables aren't set-up at the same time. 我不知道为什么人们建议不要同时设置其他因变量来使用
update-alternatives
来设置要使用的Java版本。
On Linux, and specificallly Ubuntu, development tools are not best installed via apt
. 在Linux(尤其是Ubuntu)上,最好不要通过
apt
安装开发工具。 The exception to prove the rule is RVM
, which is installed via apt
purely so that it will download ruby and ruby gems dynamically outside of apt. 证明规则的例外是
RVM
,它纯粹是通过apt
安装的,因此它将在apt外部动态下载ruby和ruby gem。
For Java, the equivalent is SDKman
, which is installed via curl
. 对于Java,等效的是
SDKman
,它是通过curl
安装的。 Once you have SDKman
then you can install Java
and other Java
type tools. 一旦有了
SDKman
就可以安装Java
和其他Java
类型的工具。
SDKman
in action: SDKman
的人:
thufir@dur:~$
thufir@dur:~$ sdk list java
================================================================================
Available Java Versions
================================================================================
12.ea.20-open
11.0.1-zulu
> * 11.0.1-open
10.0.2-zulu
10.0.2-open
9.0.7-zulu
9.0.4-open
* 8.0.192-zulu
8.0.191-oracle
7.0.201-zulu
6.0.119-zulu
1.0.0-rc-10-grl
1.0.0-rc-9-grl
1.0.0-rc-8-grl
================================================================================
+ - local version
* - installed
> - currently in use
================================================================================
thufir@dur:~$
Generally, umake
, or Ubuntu Make
, will install IDE
or other development tools. 通常,
umake
或Ubuntu Make
将安装IDE
或其他开发工具。 Currently, umake
is best installed as a snap
. 目前,最好将
umake
作为snap
安装。
The upshot is to first install SDKman
, then snap
, then use snap
to install umake
. 结果是首先安装
SDKman
,然后安装snap
,然后使用snap
安装umake
。 Between umake
and SDKman
your tools should be up to date. 在
umake
和SDKman
之间,您的工具应该是最新的。
(Ruby uses a similar RVM
, which inspired SDKman
.) (Ruby使用了类似的
RVM
,这启发了SDKman
。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.