openjdk를 올바르게 설치하는 방법은 무엇입니까?

openjdk를 올바르게 설치하는 방법은 무엇입니까?

openjdk에 문제가 있어서 지우고 다시 설치했습니다.

#  apt-get remove --purge openjdk-7-jre    
Reading package lists... Done    
Building dependency tree           
Reading state information... Done    
The following packages will be REMOVED:    
  openjdk-7-jre*    
0 upgraded, 0 newly installed, 1 to remove and 1128 not upgraded.    
After this operation, 508 kB disk space will be freed.    
Do you want to continue [Y/n]? y    
(Reading database ... 117956 files and directories currently installed.)    
Removing openjdk-7-jre:i386 ...    
update-alternatives: warning: alternative /usr/lib/jvm/java-6-openjdk-i386/jre/bin/policytool (part of link group policytool) doesn't exist; removing from list of alternatives    
update-alternatives: warning: alternative /usr/lib/jvm/java-7-openjdk-i386/jre/bin/policytool (part of link group policytool) doesn't exist; removing from list of alternatives    
update-alternatives: warning: alternative /usr/lib/jvm/java-8-oracle/jre/bin/policytool (part of link group policytool) doesn't exist; removing from list of alternatives    
update-alternatives: warning: /etc/alternatives/policytool is dangling; it will be updated with best choice    
Processing triggers for desktop-file-utils ...    
Processing triggers for hicolor-icon-theme ...    
root@localhost:/home/debian# apt-get install openjdk-7-jre    
Reading package lists... Done    
Building dependency tree           
Reading state information... Done    
The following NEW packages will be installed:    
  openjdk-7-jre    
0 upgraded, 1 newly installed, 0 to remove and 1128 not upgraded.    
Need to get 0 B/215 kB of archives.    
After this operation, 508 kB of additional disk space will be used.    
Selecting previously unselected package openjdk-7-jre:i386.    
(Reading database ... 117932 files and directories currently installed.)    
Unpacking openjdk-7-jre:i386 (from .../openjdk-7-jre_7u79-2.5.5-1~deb7u1_i386.deb) ...    
update-alternatives: warning: alternative /usr/lib/jvm/java-8-oracle/jre/bin/javaws (part of link group javaws) doesn't exist; removing from list of alternatives    
update-alternatives: warning: /etc/alternatives/javaws is dangling; it will be updated with best choice    
Processing triggers for hicolor-icon-theme ...    
Processing triggers for desktop-file-utils ...    
Setting up openjdk-7-jre:i386 (7u79-2.5.5-1~deb7u1) ...    
update-alternatives: using /usr/lib/jvm/java-7-openjdk-i386/jre/bin/policytool to provide /usr/bin/policytool (policytool) in auto mode    
# java -version    
bash: /usr/bin/java: No such file or directory    

openjdk를 사용하여 링크를 만드는 방법은 무엇입니까?

root@localhost:/home/debian# locate java
/etc/.java
/etc/java-6-openjdk
/etc/javascript-common
/etc/.java/.systemPrefs
/etc/.java/.systemPrefs/.system.lock
/etc/alternatives/java
/etc/alternatives/java.1.gz
/etc/alternatives/javac
/etc/alternatives/javac.1.gz
/etc/alternatives/javadoc
/etc/alternatives/javadoc.1.gz
/etc/alternatives/javafxpackager
/etc/alternatives/javafxpackager.1.gz
/etc/alternatives/javah
/etc/alternatives/mozilla-javaplugin.so
/etc/apache2/conf.d/javascript-common.conf
/etc/java-6-openjdk/accessibility.properties
/etc/java-6-openjdk/calendars.properties
/etc/java-6-openjdk/content-types.properties
/etc/java-6-openjdk/flavormap.properties
/etc/java-6-openjdk/fontconfig.properties
/etc/java-6-openjdk/images
/etc/java-6-openjdk/jvm-i386.cfg
/etc/java-6-openjdk/logging.properties
/etc/java-6-openjdk/management
/etc/java-6-openjdk/net.properties
/etc/java-6-openjdk/psfont.properties.ja
/etc/java-6-openjdk/psfontj2d.properties
/etc/java-6-openjdk/security
/etc/java-6-openjdk/sound.properties
/etc/java-6-openjdk/swing.properties
/etc/java-6-openjdk/tz.properties
/etc/java-6-openjdk/images/cursors
/etc/java-6-openjdk/images/cursors/cursors.properties
/etc/java-6-openjdk/management/jmxremote.access
/etc/java-6-openjdk/management/jmxremote.password
/etc/java-6-openjdk/management/management.properties
/etc/java-6-openjdk/management/snmp.acl
/etc/java-6-openjdk/security/java.policy
/etc/java-6-openjdk/security/java.security
/etc/java-6-openjdk/security/nss.cfg
/etc/javascript-common/javascript-common.conf
/etc/ssl/certs/java
/home/debian/.java
/home/debian/.config/libreoffice/3/user/config/javasettings_Linux_x86.xml
/home/debian/.java/deployment
/home/debian/.java/fonts
/home/debian/.java/deployment/CacheUpgrade.properties
/home/debian/.java/deployment/cache
/home/debian/.java/deployment/config.cache
/home/debian/.java/deployment/deployment.propertie

root@localhost:/home/debian# apt-get install openjdk-7-jre-headless
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openjdk-7-jre-headless is already the newest version.
openjdk-7-jre-headless set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1128 not upgraded.
root@localhost:/home/debian# java -version
bash: java: command not found
root@localhost:/home/debian# 

답변1

어떤 이유로 실행 파일이 openjdk-7-jre포함되지 않습니다 java. openjdk-7-jre-headless이는 사실이지만 GUI Java 프로그램을 실행해야 하는 경우에는 그다지 유용하지 않습니다.

편집하다:

헤드리스 패키지를 설치한 후:

$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Feb 13  2012 /usr/bin/java -> /etc/alternatives/java
$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 46 May 23  2013 /etc/alternatives/java -> /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
$ dpkg -S /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
openjdk-7-jre-headless:amd64: /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
$ java -version # note, not "--version" but "-version"
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)

따라서 설치 후에도 /usr/bin/java를 사용할 수 없다면 구성 단계에서 문제가 발생하게 됩니다. 루트로 실행하십시오 update-alternatives --config java.

답변2

apt-get install openjdk-7-jre-headless

답변3

JRE: Java 런타임 환경. 기본적으로 Java 프로그램을 실행하는 Java 가상 머신입니다. 또한 애플릿 실행을 위한 브라우저 플러그인도 포함되어 있습니다.

JDK: 다음을 포함한 모든 기능을 갖춘 Java 소프트웨어 개발 키트입니다.JRE, 프로그램 생성 및 컴파일을 위한 컴파일러 및 도구(예: JavaDoc 및 Java 디버거)도 포함됩니다.

따라서 jdk를 설치하는 것이 좋습니다. 이렇게 하려면 다음 명령을 입력하십시오.

sudo apt-get openjdk-7-jdk 설치

관련 정보