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

이 문제를 해결하려면 어떻게 해야 할까요?

관련 정보