Linux 上的 Java 编译

Linux 上的 Java 编译

我正在尝试编译一个基本的 java 文件,但当我尝试时收到此消息

Command 'javac' not found, but can be installed with:

sudo apt install default-jdk             (You will have to enable component called 'main')
sudo apt install openjdk-11-jdk-headless (You will have to enable component called 'main')
sudo apt install ecj                     (You will have to enable component called 'universe')
sudo apt install openjdk-8-jdk-headless  (You will have to enable component called 'universe')

当我检查 java -version 时,它显示我已经安装了一个

openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)

当我尝试下载 openjdk-8-jdk 时,我收到此消息

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 linux-image-generic : Depends: linux-image-4.15.0-74-generic but it is not going to be installed
 linux-modules-extra-4.15.0-74-generic : Depends: linux-image-4.15.0-74-generic but it is not going to be installed or
                                                  linux-image-unsigned-4.15.0-74-generic but it is not installable
 openjdk-8-jdk : Depends: openjdk-8-jre (= 8u242-b08-0ubuntu3~18.04) but it is not going to be installed
                 Depends: openjdk-8-jdk-headless (= 8u242-b08-0ubuntu3~18.04) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我尝试修复损坏的安装时,我收到此消息

faiq@faiq-desktop:~$ sudo apt --fix-broken install
apt
Usage: apt command [options]
       apt help command [options]

Commands:
  add-repository   - Add entries to apt sources.list
  autoclean        - Erase old downloaded archive files
  autoremove       - Remove automatically all unused packages
  build            - Build binary or source packages from sources
  build-dep        - Configure build-dependencies for source packages
  changelog        - View a package's changelog
  check            - Verify that there are no broken dependencies
  clean            - Erase downloaded archive files
  contains         - List packages containing a file
  content          - List files contained in a package
  deb              - Install a .deb package
  depends          - Show raw dependency information for a package
  dist-upgrade     - Upgrade the system by removing/installing/upgrading packages
  download         - Download the .deb file for a package
  edit-sources     - Edit /etc/apt/sources.list with your preferred text editor
  dselect-upgrade  - Follow dselect selections
  full-upgrade     - Same as 'dist-upgrade'
  held             - List all held packages
  help             - Show help for a command
  hold             - Hold a package
  install          - Install/upgrade packages
  list             - List packages based on package names
  policy           - Show policy settings
  purge            - Remove packages and their configuration files
  recommends       - List missing recommended packages for a particular package
  rdepends         - Show reverse dependency information for a package
  reinstall        - Download and (possibly) reinstall a currently installed package
  remove           - Remove packages
  search           - Search for a package by name and/or expression
  show             - Display detailed information about a package
  showhold         - Same as 'held'
  showsrc          - Display all the source package records that match the given package name
  source           - Download source archives
  sources          - Same as 'edit-sources'
  unhold           - Unhold a package
  update           - Download lists of new/upgradable packages
  upgrade          - Perform a safe upgrade
  version          - Show the installed version of a package

我该怎么做才能解决这个问题

相关内容