====== Java ======
Java JRE Java Runtime Environment Plugin Mozilla Iceweasel
===== Descarga versiones antiguas de java =====
http://www.oracle.com/technetwork/java/javase/archive-139210.html
===== JRE =====
Existen dos alternativas fundamentalmente para Debian:
* OpenJDK
* Sun Java. Parece ser que la version 7 tiene algun tipo de copyright restrictivo que lo hace incompatible con Debian, por lo que no existe como paquete
==== OpenJDK =====
sudo aptitude update; sudo aptitude install openjdk-6
**NOTA**: parece ser que la version 7 no tiene todavia el plugin para iceweasel
==== SUN JRE =====
1. Descargar el JRE de Oracle:
https://www.java.com/en/download/linux_manual.jsp
En mi caso "Linux x64":
http://javadl.oracle.com/webapps/download/AutoDL?BundleId=233162_512cd62ec5174c3487ac17c61aaa89e8
2. Descomprimirlo en /opt
sudo cp /path/to/jre-8u171-linux-x64.tar.gz /opt
cd /opt
sudo tar xfz jre-8u171-linux-x64.tar.gz
sudo ln -s jre1.8.0_171 java
3. Instalar la alternativa:
sudo update-alternatives --install /usr/bin/java java /opt/java/bin/java 2
4. Activarla:
sudo update-alternatives --config java
5. Seleccionar la entrada que acabamos de crear, en nuestro caso la opción 1:
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto mode
* 1 /opt/java/bin/java 2 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press to keep the current choice[*], or type selection number:
6. Comprobar que tenemos la versión de Oracle de java:
java -version
Salida esperada:
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
==== SUN JRE via java-package =====
https://wiki.debian.org/JavaPackage
1. Add a "contrib" component to /etc/apt/sources.list, for example:
# Debian 7 "Wheezy"
deb http://http.debian.net/debian/ wheezy main contrib
2. Update the list of available packages and install the java-package package:
sudo apt-get update && sudo apt-get install java-package
3. Download the desired Java JDK/JRE binary distribution (Oracle). Choose tar.gz archives or self-extracting archives, do not choose the RPM!
4. Use java-package to create a Debian package, for example:
make-jpkg jdk-7u45-linux-x64.tar.gz
5. Install the binary package created:
sudo dpkg -i oracle-j2sdk1.7_1.7.0+update45_amd64.deb
6. Hcerlo default
6.1. Obtener listado:
sudo update-alternatives --list java
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
/usr/lib/jvm/jdk-8-oracle-x64/jre/bin/java
Y:
sudo update-java-alternatives -l
java-1.7.0-openjdk-amd64 1071 /usr/lib/jvm/java-1.7.0-openjdk-amd64
jdk-8-oracle-x64 318 /usr/lib/jvm/jdk-8-oracle-x64
6.2. Seleccionar:
sudo update-alternatives --set java /usr/lib/jvm/jdk-8-oracle-x64/jre/bin/java
sudo update-java-alternatives -s jdk-8-oracle-x64
===== Plugin para iceweasel =====
==== OpenJDK =====
Probado en Jessie:
sudo aptitude install icedtea-plugin
==== SUN JRE ====
1. Descargar el JRE de Oracle:
https://www.java.com/en/download/linux_manual.jsp
En mi caso "Linux x64":
http://javadl.oracle.com/webapps/download/AutoDL?BundleId=233162_512cd62ec5174c3487ac17c61aaa89e8
2. Descomprimirlo en /opt
sudo cp /path/to/jre-8u171-linux-x64.tar.gz /opt
cd /opt
sudo tar xfz jre-8u171-linux-x64.tar.gz
sudo ln -s jre1.8.0_171 java
3. Instalar la alternativa:
sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /opt/java/lib/amd64/libnpjp2.so 1
4. Activarla:
sudo update-alternatives --config mozilla-javaplugin.so
5. Seleccionar la entrada que acabamos de crear, en nuestro caso la opción 1:
There are 2 choices for the alternative mozilla-javaplugin.so (providing /usr/lib/mozilla/plugins/libjavaplugin.so).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so 1081 auto mode
* 1 /opt/java/lib/amd64/libnpjp2.so 1 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so 1081 manual mode
Press to keep the current choice[*], or type selection number:
6. Cerrar (si está abierto firefox) y volver a abrir
7. Teclar en la barra de navegación:
about:plugins
Salida esperada:
Java(TM) Plug-in 11.171.2
File: libnpjp2.so
Path: /opt/jre1.8.0_171/lib/amd64/libnpjp2.so
Version: 11.171.2
State: Enabled
Next Generation Java Plug-in 11.171.2 for Mozilla browsers
MIME Type Description Suffixes
application/x-java-vm Java Plug-in
application/x-java-applet Java Plug-in Applet
application/x-java-bean Java Plug-in JavaBeans
application/x-java-applet;version=1.1 Java Plug-in
application/x-java-bean;version=1.1 Java Plug-in
application/x-java-applet;version=1.1.1 Java Plug-in
application/x-java-bean;version=1.1.1 Java Plug-in
application/x-java-applet;version=1.1.2 Java Plug-in
application/x-java-bean;version=1.1.2 Java Plug-in
application/x-java-applet;version=1.1.3 Java Plug-in
application/x-java-bean;version=1.1.3 Java Plug-in
application/x-java-applet;version=1.2 Java Plug-in
application/x-java-bean;version=1.2 Java Plug-in
application/x-java-applet;version=1.2.1 Java Plug-in
application/x-java-bean;version=1.2.1 Java Plug-in
application/x-java-applet;version=1.2.2 Java Plug-in
application/x-java-bean;version=1.2.2 Java Plug-in
application/x-java-applet;version=1.3 Java Plug-in
application/x-java-bean;version=1.3 Java Plug-in
application/x-java-applet;version=1.3.1 Java Plug-in
application/x-java-bean;version=1.3.1 Java Plug-in
application/x-java-applet;version=1.4 Java Plug-in
application/x-java-bean;version=1.4 Java Plug-in
application/x-java-applet;version=1.4.1 Java Plug-in
application/x-java-bean;version=1.4.1 Java Plug-in
application/x-java-applet;version=1.4.2 Java Plug-in
application/x-java-bean;version=1.4.2 Java Plug-in
application/x-java-applet;version=1.5 Java Plug-in
application/x-java-bean;version=1.5 Java Plug-in
application/x-java-applet;version=1.6 Java Plug-in
application/x-java-bean;version=1.6 Java Plug-in
application/x-java-applet;version=1.7 Java Plug-in
application/x-java-bean;version=1.7 Java Plug-in
application/x-java-applet;jpi-version=1.8.0_171 Java Plug-in
application/x-java-bean;jpi-version=1.8.0_171 Java Plug-in
application/x-java-applet;version=1.8 Java Plug-in
application/x-java-bean;version=1.8 Java Plug-in
application/x-java-applet;deploy=11.171.2 Java Plug-in
application/x-java-applet;javafx=8.0.171 Java Plug-in
application/x-java-vm-npruntime Java Plug-in
===== Error eclipse y java solo debian =====
Leer http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560142#35
Solución:
1. Editar:
mv /etc/sysctl.d/bindv6only.conf /etc/sysctl.d/bindv6only.conf.falla
Y dejar la linea tal que así:
net.ipv6.bindv6only = 0
Grabar y salir
2. No se si hace falta reiniciar algún servicio para que los cambios tomen efecto, yo reinicié el ordeñador
===== Descomprimir .jar =====
jar xf mi_archivo.jar
===== Java Media Framework =====
A mi solo me funciona con eclipse, no consigo exportar las variables para que tire.
1. Descargar:
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=7372-jmf-2.1.1e-oth-JPR@CDS-CDS_Developer
2. Seleccionar 'Linux', marcar la aceptación de la licencia y pulsar 'Continue >>'
3. Marcar 'Cross-platform Java' y pulsar sobre el enlace 'jmf-2_1_1e-alljava.zip'
4. Descomprimir el .zip por ejemplo en:
/usr/local/lib
5. Arrancar eclipse
6. Seleccionar Window/Preferences/Java/Installed JREs
7. Si no estuviera seleccionado 'java-6-sun-xxx' pulsar sobre el botón 'Add...'
8. Navegar hasta:
/usr/lib/jvm/java-6-sun
**NOTA**: si no existe ese directorio, instalar:
aptitude update && aptitude install sun-java6-jre
9. Pulsar sobre el botón 'Ok'
===== Bluetooth =====
Si se obtiene el siguiente error intentando ejecutar una aplicación con las bibliotecas bluecove:
Native Library bluecove not available
Solución:
sudo aptitude install libbluetooth-dev
===== Anyadir certificado a keystore de Firefox =====
http://proxyinverso.blogspot.com.es/2014/09/anadir-un-certificado-al-almacen-de.html
keytool -importkeystore -srckeystore /xxxx/xxxx/xxxx/certificado.p12 -srcstoretype pkcs12 -destkeystore /home/usuarioxxx/.java/deployment/security/trusted.clientcerts
A continuacion teclear 3 veces **una contrasenya fuerte**, sino obtendreis este error:
keytool error: java.io.IOException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded
===== Cambiar máquina de java =====
==== Compilando paquete ====
Nos bajamos el fichero de la máquina java que queremos instalar:
jdk-7u80-linux-x64.tar.gz
Ahora lo tenemos que convertir en paquete debian para poder cambiar como alternativa.
Instalamos java-package. Como usuario no root ejecutamos:
make-jpkg jdk-7u80-linux-x64.tar.gz
Nos crea el paquete:
oracle-java7-jdk_7u80_amd64.deb
Instalamos el paquete y nos aparece como alternativa.
==== Descomprimiendo jvm de forma manual ====
Descomprimimos la JVM en /usr/lib/jvm/jdk1.7.0_80/
Luego lo añadimos como alternativa para java y javac. El último número es la prioridad:
update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_80/bin/java 100
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_80/bin/javac 100
=== Cambiando de JVM ===
Ahora seleccionamos la nueva jvm:
# update-alternatives --config java
Existen 2 opciones para la alternativa java (que provee /usr/bin/java).
Selección Ruta Prioridad Estado
------------------------------------------------------------
0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 modo automático
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 modo manual
* 2 /usr/lib/jvm/jdk1.7.0_80/bin/java 100 modo manual