Como instalar o openjdk corretamente?

0

Algo errado no meu openjdk, eu purgá-lo e reinstalá-lo.

#  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    

Como fazer um link para fazer uso do 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# 
    
por it_is_a_literature 15.07.2015 / 11:31

3 respostas

1

Por algum motivo, openjdk-7-jre não contém um executável java . openjdk-7-jre-headless , mas isso não é muito útil se você precisar executar um programa java da GUI.

EDITAR:

Depois de instalar o pacote sem cabeça:

$ 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)

Então, se após a instalação você ainda não tiver um / usr / bin / java em funcionamento, então algo deu errado durante a fase de configuração. Execute update-alternatives --config java como root.

    
por 15.07.2015 / 11:44
0

apt-get install openjdk-7-jre-headless

    
por 15.07.2015 / 11:55
0

JRE : Java Runtime Environment. É basicamente a Java Virtual Machine na qual seus programas Java são executados. Também inclui plugins de navegador para execução de Applet.

JDK : É o Software Development Kit completo para Java, incluindo JRE , e os compiladores e ferramentas (como JavaDoc e Java Debugger) para criar e compilar programas .

Então, é melhor se você instalar o jdk.Para fazer isso, digite o seguinte:

sudo apt-get install openjdk-7-jdk

    
por 15.07.2015 / 16:17

Tags