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

この問題を解決するにはどうすればよいですか?

ベストアンサー1

おすすめ記事