gpt4 book ai didi

java - 如何在 Ubuntu 上为 React-native 安装 Java(openjdk)

转载 作者:太空宇宙 更新时间:2023-11-04 11:47:23 24 4
gpt4 key购买 nike

我尝试为 react-native 安装 open-jdk。但是我遇到了一些问题。我该如何解决?谢谢

$ sudo apt update 
$ sudo apt install default-jdk

Reading package lists... Done
Building dependency tree
Reading state information... Done
default-jdk is already the newest version (2:1.11-68ubuntu1~18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up oracle-java11-installer-local (11.0.4-1~linuxuprising1) ...
Before installing this package,
please download the Oracle JDK 11 .tar.gz file
with the same version as this package (version 11.0.4),
and place it in /var/cache/oracle-jdk11-installer-local,

E.g.:
sudo mkdir -p /var/cache/oracle-jdk11-installer-local
sudo cp jdk-11.0.4_linux-x64_bin.tar.gz /var/cache/oracle-jdk11-
installer-local/
sha256sum mismatch jdk-11.0.4_linux-x64_bin.tar.gz
Oracle JDK 11 is NOT installed.
dpkg: error processing package oracle-java11-installer-local (--
configure):
installed oracle-java11-installer-local package post-installation
script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of default-jre:
default-jre depends on openjdk-11-jre; however:
Package openjdk-11-jre is not installed.
Package oracle-java12-installer which provides openjdk-11-jre is
not
installed.
Package oracle-java11-installer-local which provides openjdk-11-jre
is not configured yet.

Errors were encountered while processing:

oracle-java11-installer-local
default-jre
default-jdk
default-jre-headless
default-jdk-headless

E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试删除 java 和 java 的存储库并重新安装但没有响应。对不起我的英语。

编辑

如果我运行这段代码:

java -version

给出输出:

openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-
0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

我不在 Android Studio 中使用 Java。

最佳答案

试试这些命令:

添加存储库

sudo add-apt-repository ppa:openjdk-r/ppa

更新包

sudo apt-get update

安装 OpenJDK 8:

sudo apt-get install openjdk-8-jdk

关于java - 如何在 Ubuntu 上为 React-native 安装 Java(openjdk),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57216398/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com