Diferencia entre revisiones de «Java»

De Guía Ubuntu
Saltar a: navegación, buscar
(Configurar el path de JAVAC (para las versiones JDK))
Línea 109: Línea 109:
 
* [http://wiki.serios.net/wiki/Debian_Java_JRE/JDK_installation_with_java-package Debian Java JRE/JDK installation with java-package] {{en}}
 
* [http://wiki.serios.net/wiki/Debian_Java_JRE/JDK_installation_with_java-package Debian Java JRE/JDK installation with java-package] {{en}}
  
[[Categoría:Lenguajes]]
+
==update-java-alternatives ia32-java-6-sun==
 +
You are correct. The file does exist. What does not exist is a debian packager "alternative" definition for that contains that file. You have to install the alternative first.
 +
 
 +
The problem with the "update-java-alternatives" script is that it only changes which alternative is set. It does not actually add any files to the alternative definitions.
 +
 
 +
To set a definition for an alternative, you have to run update-alternatives with the --install option. I manually installed the jdk (with the jre) from sun's site to /usr/lib/jvm/ia32-java-6-sun, and then created my own script to install the alternatives before updating them.
 +
 
 +
update-java-alternatives reads the .jinfo file for the selected set of alternatives in /usr/lib/jvm, which contains 3 of the four needed arguments for an alternative (priority, name, and path), but does not contain the name of the link created by the alternative, so it cannot create it if it does not exist, and has not been programmed to install a new alternative, but only to select from existing ones.
 +
 
 +
This script created all the alternatives for me. Set the priority high if you want ia32-java-6-sun to get automatic preference. Set it low if you do not. 1075 was higher than anything on my system. This script created all the alternatives for me. Note that I used the ns7-gcc29 versions of libjavaplugin_oji.so, and that I coded the location of the links to the /usr/lib/<browsername>/plugins directory. This may or not be correct (verify for yourself). Note also that I modeled the structure after the real ubuntu ia32-java-6-sun package structure for consistency, including replicating their structure for sybolic links, and gziping all the man files. This script could have been shorter, but I threw it together pretty quicly using sed and a copy of the .ia32-java-6-sun.jinfo file.
 +
 
 +
Here is my script (ia32-java-6-sun.sh):
 +
 
 +
  #!/bin/sh
 +
  export JAVA_PACKAGE_NAME=ia32-java-6-sun-1.6.0.06
 +
  export JAVA_PACKAGE_ALIAS=ia32-java-6-sun
 +
  export JAVA_PACKAGE_PRIORITY=1075
 +
  export JAVA_PACKAGE_SECTION=non-free
 +
  #
 +
update-alternatives --install /usr/bin/ControlPanel ControlPanel /usr/lib/jvm/ia32-java-6-sun/jre/bin/ControlPanel $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto ControlPanel
 +
update-alternatives --install /usr/bin/java java /usr/lib/jvm/ia32-java-6-sun/jre/bin/java $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/java.1.gz
 +
update-alternatives --auto java
 +
update-alternatives --install /usr/bin/java_vm java_vm /usr/lib/jvm/ia32-java-6-sun/jre/bin/java_vm $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto java_vm
 +
update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/ia32-java-6-sun/jre/bin/javaws $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javaws.1.gz javaws.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javaws.1.gz
 +
update-alternatives --auto javaws
 +
update-alternatives --install /usr/bin/jcontrol jcontrol /usr/lib/jvm/ia32-java-6-sun/jre/bin/jcontrol $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto jcontrol
 +
update-alternatives --install /usr/bin/keytool keytool /usr/lib/jvm/ia32-java-6-sun/jre/bin/keytool $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/keytool.1.gz
 +
update-alternatives --auto keytool
 +
update-alternatives --install /usr/bin/pack200 pack200 /usr/lib/jvm/ia32-java-6-sun/jre/bin/pack200 $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/pack200.1.gz
 +
update-alternatives --auto pack200
 +
update-alternatives --install /usr/bin/policytool policytool /usr/lib/jvm/ia32-java-6-sun/jre/bin/policytool $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/policytool.1.gz
 +
update-alternatives --auto policytool
 +
update-alternatives --install /usr/bin/rmid rmid /usr/lib/jvm/ia32-java-6-sun/jre/bin/rmid $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/rmid.1.gz
 +
update-alternatives --auto rmid
 +
update-alternatives --install /usr/bin/rmiregistry rmiregistry /usr/lib/jvm/ia32-java-6-sun/jre/bin/rmiregistry $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/rmiregistry.1.gz
 +
update-alternatives --auto rmiregistry
 +
update-alternatives --install /usr/bin/unpack200 unpack200 /usr/lib/jvm/ia32-java-6-sun/jre/bin/unpack200 $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/unpack200.1.gz
 +
update-alternatives --auto unpack200
 +
update-alternatives --install /usr/bin/orbd orbd /usr/lib/jvm/ia32-java-6-sun/jre/bin/orbd $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/orbd.1.gz
 +
update-alternatives --auto orbd
 +
update-alternatives --install /usr/bin/servertool servertool /usr/lib/jvm/ia32-java-6-sun/jre/bin/servertool $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/servertool.1.gz
 +
update-alternatives --auto servertool
 +
update-alternatives --install /usr/bin/tnameserv tnameserv /usr/lib/jvm/ia32-java-6-sun/jre/bin/tnameserv $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/tnameserv.1.gz
 +
update-alternatives --auto tnameserv
 +
update-alternatives --install /usr/bin/HtmlConverter HtmlConverter /usr/lib/jvm/ia32-java-6-sun/bin/HtmlConverter $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto HtmlConverter
 +
update-alternatives --install /usr/bin/appletviewer appletviewer /usr/lib/jvm/ia32-java-6-sun/bin/appletviewer $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/appletviewer.1.gz
 +
update-alternatives --auto appletviewer
 +
update-alternatives --install /usr/bin/apt apt /usr/lib/jvm/ia32-java-6-sun/bin/apt $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/apt.1.gz
 +
update-alternatives --auto apt
 +
update-alternatives --install /usr/bin/extcheck extcheck /usr/lib/jvm/ia32-java-6-sun/bin/extcheck $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/extcheck.1.gz
 +
update-alternatives --auto extcheck
 +
update-alternatives --install /usr/bin/idlj idlj /usr/lib/jvm/ia32-java-6-sun/bin/idlj $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/idlj.1.gz idlj.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/idlj.1.gz
 +
update-alternatives --auto idlj
 +
update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/ia32-java-6-sun/bin/jar $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jar.1.gz
 +
update-alternatives --auto jar
 +
update-alternatives --install /usr/bin/jarsigner jarsigner /usr/lib/jvm/ia32-java-6-sun/bin/jarsigner $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jarsigner.1.gz
 +
update-alternatives --auto jarsigner
 +
update-alternatives --install /usr/bin/java-rmi.cgi java-rmi.cgi /usr/lib/jvm/ia32-java-6-sun/bin/java-rmi.cgi $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/java-rmi.cgi.1.gz java-rmi.cgi.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/java-rmi.cgi.1.gz
 +
update-alternatives --auto java-rmi.cgi
 +
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/ia32-java-6-sun/bin/javac $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javac.1.gz
 +
update-alternatives --auto javac
 +
update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/ia32-java-6-sun/bin/javadoc $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javadoc.1.gz
 +
update-alternatives --auto javadoc
 +
update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/ia32-java-6-sun/bin/javah $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javah.1.gz
 +
update-alternatives --auto javah
 +
update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/ia32-java-6-sun/bin/javap $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javap.1.gz
 +
update-alternatives --auto javap
 +
update-alternatives --install /usr/bin/jconsole jconsole /usr/lib/jvm/ia32-java-6-sun/bin/jconsole $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jconsole.1.gz
 +
update-alternatives --auto jconsole
 +
update-alternatives --install /usr/bin/jdb jdb /usr/lib/jvm/ia32-java-6-sun/bin/jdb $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jdb.1.gz
 +
update-alternatives --auto jdb
 +
update-alternatives --install /usr/bin/jhat jhat /usr/lib/jvm/ia32-java-6-sun/bin/jhat $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jhat.1.gz
 +
update-alternatives --auto jhat
 +
update-alternatives --install /usr/bin/jinfo jinfo /usr/lib/jvm/ia32-java-6-sun/bin/jinfo $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jinfo.1.gz
 +
update-alternatives --auto jinfo
 +
update-alternatives --install /usr/bin/jmap jmap /usr/lib/jvm/ia32-java-6-sun/bin/jmap $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jmap.1.gz
 +
update-alternatives --auto jmap
 +
update-alternatives --install /usr/bin/jps jps /usr/lib/jvm/ia32-java-6-sun/bin/jps $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jps.1.gz
 +
update-alternatives --auto jps
 +
update-alternatives --install /usr/bin/jrunscript jrunscript /usr/lib/jvm/ia32-java-6-sun/bin/jrunscript $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jrunscript.1.gz
 +
update-alternatives --auto jrunscript
 +
update-alternatives --install /usr/bin/jsadebugd jsadebugd /usr/lib/jvm/ia32-java-6-sun/bin/jsadebugd $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jsadebugd.1.gz
 +
update-alternatives --auto jsadebugd
 +
update-alternatives --install /usr/bin/jstack jstack /usr/lib/jvm/ia32-java-6-sun/bin/jstack $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jstack.1.gz
 +
update-alternatives --auto jstack
 +
update-alternatives --install /usr/bin/jstat jstat /usr/lib/jvm/ia32-java-6-sun/bin/jstat $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jstat.1.gz
 +
update-alternatives --auto jstat
 +
update-alternatives --install /usr/bin/jstatd jstatd /usr/lib/jvm/ia32-java-6-sun/bin/jstatd $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jstatd.1.gz
 +
update-alternatives --auto jstatd
 +
update-alternatives --install /usr/bin/native2ascii native2ascii /usr/lib/jvm/ia32-java-6-sun/bin/native2ascii $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/native2ascii.1.gz
 +
update-alternatives --auto native2ascii
 +
update-alternatives --install /usr/bin/rmic rmic /usr/lib/jvm/ia32-java-6-sun/bin/rmic $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/rmic.1.gz
 +
update-alternatives --auto rmic
 +
update-alternatives --install /usr/bin/schemagen schemagen /usr/lib/jvm/ia32-java-6-sun/bin/schemagen $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/schemagen.1.gz
 +
update-alternatives --auto schemagen
 +
update-alternatives --install /usr/bin/serialver serialver /usr/lib/jvm/ia32-java-6-sun/bin/serialver $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/serialver.1.gz
 +
update-alternatives --auto serialver
 +
update-alternatives --install /usr/bin/wsgen wsgen /usr/lib/jvm/ia32-java-6-sun/bin/wsgen $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/wsgen.1.gz
 +
update-alternatives --auto wsgen
 +
update-alternatives --install /usr/bin/wsimport wsimport /usr/lib/jvm/ia32-java-6-sun/bin/wsimport $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/wsimport.1.gz
 +
update-alternatives --auto wsimport
 +
update-alternatives --install /usr/bin/xjc xjc /usr/lib/jvm/ia32-java-6-sun/bin/xjc $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/xjc.1.gz
 +
update-alternatives --auto xjc
 +
update-alternatives --install /usr/lib/xulrunner-addons/plugins/javaplugin_oji.so xulrunner-addons-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto xulrunner-addons-javaplugin.so
 +
update-alternatives --install /usr/lib/firefox/plugins/javaplugin_oji.so firefox-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto firefox-javaplugin.so
 +
update-alternatives --install /usr/lib/iceape/plugins/javaplugin_oji.so iceape-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto iceape-javaplugin.so
 +
update-alternatives --install /usr/lib/iceweasel/plugins/javaplugin_oji.so iceweasel-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto iceweasel-javaplugin.so
 +
update-alternatives --install /usr/lib/mozilla/plugins/javaplugin_oji.so mozilla-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto mozilla-javaplugin.so
 +
update-alternatives --install /usr/lib/midbrowser/plugins/javaplugin_oji.so midbrowser-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto midbrowser-javaplugin.so
 +
update-alternatives --install /usr/lib/xulrunner/plugins/javaplugin_oji.so xulrunner-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto xulrunner-javaplugin.so
 +
update-alternatives --install /usr/lib/firefox-3.0/plugins/javaplugin_oji.so firefox-3.0-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY
 +
update-alternatives --auto firefox-3.0-javaplugin.so
 +
#
 +
 
 +
 
 +
To make this consistent with my /usr/lib/jvm/.ia32-java-6-sun.jinfo file, I changed it as well:

Revisión de 23:57 21 sep 2009

Java
Logo java.gif
 
Sun Microsystems
6 / 11 de diciembre de 2006
7 / 2006
sun-java6-*
-
Lenguajes de programación
libre (CDDL)
No
www.java.com/es

Java es un lenguaje de programación orientado a objetos. Las aplicaciones Java se ejecutan en una máquina virtual, por lo tanto son multiplataforma, lo que implica cierto procesamiento inicial, haciendo algunos programas más lentos que las aplicaciones programadas en otros lenguajes nativos. Aunque en las últimas versiones esta diferencia se hace menos patente.

Por defecto, en Ubuntu nos encontramos con una versión libre del JRE (Java Runtime Environment, Entorno de Ejecución de Java) de Java, pero lamentablemente es una versión antigua, la 1.4.2. Actualmente Java ya es de código abierto, y se encuentra en la versión 6 (en la antigua nomenclatura es la versión 1.6.0).

Instalación

Desde los repositorios de Ubuntu

Otra forma sencilla de instalar el JRE6 o el JDK6, es usar los repositorios oficiales de Ubuntu. Para ello, simplemente debemos instalar desde los repositorios los paquetes sun-java6-bin, sun-java6-jre y sun-java6-jdk, respectivamente.

Desde la web de Java

Si tienes dificultades con el anterior caso, puedes descargarte del sitio web de Sun el JRE6 o, en caso de que desees programar, el JDK6. Una vez descargado, tenemos que cambiarle los permisos al fichero para que se pueda ejecutar e instalarlo. Seguimos los siguientes pasos:

En una terminal, nos vamos a la carpeta donde hemos descargado el fichero .bin:

$ cd <carpeta>

Le damos permisos de ejecución al archivo (cambiar jre por jdk si es el caso) y lo ejecutamos para instalarlo :

$ chmod +x jre-6-linux-i586.bin
$ sudo ./jre-6-linux-i586.bin

Seguimos las instrucciones que van apareciendo en pantalla, que son 2 o 3.

Movemos la carpeta creada después de la instalación (llamada jre1.6.0) a una más apropiada:

$ sudo mv jre1.6.0 /usr/lib/jvm

Seteamos el nuevo Java como una de las "alternativas de java":

$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.6.0/bin/java" 1

Ahora seteamos la "nueva alternativa" como la real de Java. Este paso hace que la version de sun sea la usada por defecto :

$ sudo update-alternatives --set java /usr/lib/jvm/jre1.6.0/bin/java

Para comprobar si tenemos la versión 1.6.0, tipeamos en la terminal:

$ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)

Configurar el path de JAVAC (para las versiones JDK)

Posiblemente te hayas dado cuenta que al intentar compilar un archivo Java con algún programa (por ejemplo, jGRASP), aparece un error que dice: javac no fue encontrado. Los requisitos para poder configurar el path de javac es haber instalado algún JDK, en este ejemplo se usa el JDK6.

Nota clasica.png Las instrucciones de instalación de JDK 6 se encuentran en la sección Instalación -> Desde la web de Java -> JDK 6 de este artículo.

Pues bien, primero abrimos una terminal. Luego, tendremos que hacer esto (las rutas mostradas corresponden al JDK6 instalado como se muestra en esta guía):

1. Setear javac de JDK como una "alternativa" (todo en la misma linea), ya que el sistema no lo reconoce:

$  sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_XX/bin/javac" 1 (XX la vesion del JDK que se descargo)
  

2. Ahora seteamos la "nueva alternativa" como la real de javac en el sistema:

$  sudo update-alternatives --set javac /usr/lib/jvm/jdk1.6.0_XX/bin/javac

3. Para comprobar si tenemos la versión de javac 1.6.0_06, tipeamos en la terminal:

$ javac -version

Después de esta instrucción, tendrá que aparecer algo así:

javac 1.6.0_06

Ya tienes javac configurado y listo para usar. Ahora podrás compilar sin ningún problema.

Instalación del plugin para Firefox

Desde los repositorios oficiales de Ubuntu

Si queremos disponer del plugin que nos permite utilizar applets Java dentro del navegador Firefox, la manera más sencilla es instalar el paquete sun-java6-plugin de los repositorios oficiales de Ubuntu.

Posibles problemas

No se ve la interfaz gráfica de aplicaciones hechas en Java si está funcionando Compiz Fusion

Escribe en un terminal:

$ sudo gedit /etc/environment

y agrega la siguiente línea:

AWT_TOOLKIT="MToolkit"

guarda el archivo, reinicia el entorno gráfico y listo.

Ver también

Enlaces externos

Colabora en Wikipedia Wikipedia alberga un artículo enciclopédico sobre Java. (en español)

update-java-alternatives ia32-java-6-sun

You are correct. The file does exist. What does not exist is a debian packager "alternative" definition for that contains that file. You have to install the alternative first.

The problem with the "update-java-alternatives" script is that it only changes which alternative is set. It does not actually add any files to the alternative definitions.

To set a definition for an alternative, you have to run update-alternatives with the --install option. I manually installed the jdk (with the jre) from sun's site to /usr/lib/jvm/ia32-java-6-sun, and then created my own script to install the alternatives before updating them.

update-java-alternatives reads the .jinfo file for the selected set of alternatives in /usr/lib/jvm, which contains 3 of the four needed arguments for an alternative (priority, name, and path), but does not contain the name of the link created by the alternative, so it cannot create it if it does not exist, and has not been programmed to install a new alternative, but only to select from existing ones.

This script created all the alternatives for me. Set the priority high if you want ia32-java-6-sun to get automatic preference. Set it low if you do not. 1075 was higher than anything on my system. This script created all the alternatives for me. Note that I used the ns7-gcc29 versions of libjavaplugin_oji.so, and that I coded the location of the links to the /usr/lib/<browsername>/plugins directory. This may or not be correct (verify for yourself). Note also that I modeled the structure after the real ubuntu ia32-java-6-sun package structure for consistency, including replicating their structure for sybolic links, and gziping all the man files. This script could have been shorter, but I threw it together pretty quicly using sed and a copy of the .ia32-java-6-sun.jinfo file.

Here is my script (ia32-java-6-sun.sh):

  #!/bin/sh
  export JAVA_PACKAGE_NAME=ia32-java-6-sun-1.6.0.06
  export JAVA_PACKAGE_ALIAS=ia32-java-6-sun
  export JAVA_PACKAGE_PRIORITY=1075
  export JAVA_PACKAGE_SECTION=non-free
  #

update-alternatives --install /usr/bin/ControlPanel ControlPanel /usr/lib/jvm/ia32-java-6-sun/jre/bin/ControlPanel $JAVA_PACKAGE_PRIORITY update-alternatives --auto ControlPanel update-alternatives --install /usr/bin/java java /usr/lib/jvm/ia32-java-6-sun/jre/bin/java $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/java.1.gz java.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/java.1.gz update-alternatives --auto java update-alternatives --install /usr/bin/java_vm java_vm /usr/lib/jvm/ia32-java-6-sun/jre/bin/java_vm $JAVA_PACKAGE_PRIORITY update-alternatives --auto java_vm update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/ia32-java-6-sun/jre/bin/javaws $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javaws.1.gz javaws.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javaws.1.gz update-alternatives --auto javaws update-alternatives --install /usr/bin/jcontrol jcontrol /usr/lib/jvm/ia32-java-6-sun/jre/bin/jcontrol $JAVA_PACKAGE_PRIORITY update-alternatives --auto jcontrol update-alternatives --install /usr/bin/keytool keytool /usr/lib/jvm/ia32-java-6-sun/jre/bin/keytool $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/keytool.1.gz keytool.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/keytool.1.gz update-alternatives --auto keytool update-alternatives --install /usr/bin/pack200 pack200 /usr/lib/jvm/ia32-java-6-sun/jre/bin/pack200 $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/pack200.1.gz pack200.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/pack200.1.gz update-alternatives --auto pack200 update-alternatives --install /usr/bin/policytool policytool /usr/lib/jvm/ia32-java-6-sun/jre/bin/policytool $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/policytool.1.gz policytool.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/policytool.1.gz update-alternatives --auto policytool update-alternatives --install /usr/bin/rmid rmid /usr/lib/jvm/ia32-java-6-sun/jre/bin/rmid $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/rmid.1.gz rmid.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/rmid.1.gz update-alternatives --auto rmid update-alternatives --install /usr/bin/rmiregistry rmiregistry /usr/lib/jvm/ia32-java-6-sun/jre/bin/rmiregistry $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/rmiregistry.1.gz update-alternatives --auto rmiregistry update-alternatives --install /usr/bin/unpack200 unpack200 /usr/lib/jvm/ia32-java-6-sun/jre/bin/unpack200 $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/unpack200.1.gz unpack200.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/unpack200.1.gz update-alternatives --auto unpack200 update-alternatives --install /usr/bin/orbd orbd /usr/lib/jvm/ia32-java-6-sun/jre/bin/orbd $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/orbd.1.gz orbd.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/orbd.1.gz update-alternatives --auto orbd update-alternatives --install /usr/bin/servertool servertool /usr/lib/jvm/ia32-java-6-sun/jre/bin/servertool $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/servertool.1.gz servertool.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/servertool.1.gz update-alternatives --auto servertool update-alternatives --install /usr/bin/tnameserv tnameserv /usr/lib/jvm/ia32-java-6-sun/jre/bin/tnameserv $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/tnameserv.1.gz tnameserv.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/tnameserv.1.gz update-alternatives --auto tnameserv update-alternatives --install /usr/bin/HtmlConverter HtmlConverter /usr/lib/jvm/ia32-java-6-sun/bin/HtmlConverter $JAVA_PACKAGE_PRIORITY update-alternatives --auto HtmlConverter update-alternatives --install /usr/bin/appletviewer appletviewer /usr/lib/jvm/ia32-java-6-sun/bin/appletviewer $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/appletviewer.1.gz appletviewer.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/appletviewer.1.gz update-alternatives --auto appletviewer update-alternatives --install /usr/bin/apt apt /usr/lib/jvm/ia32-java-6-sun/bin/apt $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/apt.1.gz apt.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/apt.1.gz update-alternatives --auto apt update-alternatives --install /usr/bin/extcheck extcheck /usr/lib/jvm/ia32-java-6-sun/bin/extcheck $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/extcheck.1.gz extcheck.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/extcheck.1.gz update-alternatives --auto extcheck update-alternatives --install /usr/bin/idlj idlj /usr/lib/jvm/ia32-java-6-sun/bin/idlj $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/idlj.1.gz idlj.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/idlj.1.gz update-alternatives --auto idlj update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/ia32-java-6-sun/bin/jar $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jar.1.gz jar.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jar.1.gz update-alternatives --auto jar update-alternatives --install /usr/bin/jarsigner jarsigner /usr/lib/jvm/ia32-java-6-sun/bin/jarsigner $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jarsigner.1.gz jarsigner.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jarsigner.1.gz update-alternatives --auto jarsigner update-alternatives --install /usr/bin/java-rmi.cgi java-rmi.cgi /usr/lib/jvm/ia32-java-6-sun/bin/java-rmi.cgi $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/java-rmi.cgi.1.gz java-rmi.cgi.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/java-rmi.cgi.1.gz update-alternatives --auto java-rmi.cgi update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/ia32-java-6-sun/bin/javac $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javac.1.gz javac.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javac.1.gz update-alternatives --auto javac update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/ia32-java-6-sun/bin/javadoc $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javadoc.1.gz javadoc.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javadoc.1.gz update-alternatives --auto javadoc update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/ia32-java-6-sun/bin/javah $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javah.1.gz javah.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javah.1.gz update-alternatives --auto javah update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/ia32-java-6-sun/bin/javap $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/javap.1.gz javap.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/javap.1.gz update-alternatives --auto javap update-alternatives --install /usr/bin/jconsole jconsole /usr/lib/jvm/ia32-java-6-sun/bin/jconsole $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jconsole.1.gz jconsole.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jconsole.1.gz update-alternatives --auto jconsole update-alternatives --install /usr/bin/jdb jdb /usr/lib/jvm/ia32-java-6-sun/bin/jdb $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jdb.1.gz jdb.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jdb.1.gz update-alternatives --auto jdb update-alternatives --install /usr/bin/jhat jhat /usr/lib/jvm/ia32-java-6-sun/bin/jhat $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jhat.1.gz jhat.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jhat.1.gz update-alternatives --auto jhat update-alternatives --install /usr/bin/jinfo jinfo /usr/lib/jvm/ia32-java-6-sun/bin/jinfo $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jinfo.1.gz jinfo.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jinfo.1.gz update-alternatives --auto jinfo update-alternatives --install /usr/bin/jmap jmap /usr/lib/jvm/ia32-java-6-sun/bin/jmap $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jmap.1.gz jmap.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jmap.1.gz update-alternatives --auto jmap update-alternatives --install /usr/bin/jps jps /usr/lib/jvm/ia32-java-6-sun/bin/jps $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jps.1.gz jps.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jps.1.gz update-alternatives --auto jps update-alternatives --install /usr/bin/jrunscript jrunscript /usr/lib/jvm/ia32-java-6-sun/bin/jrunscript $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jrunscript.1.gz jrunscript.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jrunscript.1.gz update-alternatives --auto jrunscript update-alternatives --install /usr/bin/jsadebugd jsadebugd /usr/lib/jvm/ia32-java-6-sun/bin/jsadebugd $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jsadebugd.1.gz jsadebugd.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jsadebugd.1.gz update-alternatives --auto jsadebugd update-alternatives --install /usr/bin/jstack jstack /usr/lib/jvm/ia32-java-6-sun/bin/jstack $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jstack.1.gz jstack.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jstack.1.gz update-alternatives --auto jstack update-alternatives --install /usr/bin/jstat jstat /usr/lib/jvm/ia32-java-6-sun/bin/jstat $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jstat.1.gz jstat.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jstat.1.gz update-alternatives --auto jstat update-alternatives --install /usr/bin/jstatd jstatd /usr/lib/jvm/ia32-java-6-sun/bin/jstatd $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/jstatd.1.gz jstatd.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/jstatd.1.gz update-alternatives --auto jstatd update-alternatives --install /usr/bin/native2ascii native2ascii /usr/lib/jvm/ia32-java-6-sun/bin/native2ascii $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/native2ascii.1.gz native2ascii.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/native2ascii.1.gz update-alternatives --auto native2ascii update-alternatives --install /usr/bin/rmic rmic /usr/lib/jvm/ia32-java-6-sun/bin/rmic $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/rmic.1.gz rmic.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/rmic.1.gz update-alternatives --auto rmic update-alternatives --install /usr/bin/schemagen schemagen /usr/lib/jvm/ia32-java-6-sun/bin/schemagen $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/schemagen.1.gz schemagen.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/schemagen.1.gz update-alternatives --auto schemagen update-alternatives --install /usr/bin/serialver serialver /usr/lib/jvm/ia32-java-6-sun/bin/serialver $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/serialver.1.gz serialver.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/serialver.1.gz update-alternatives --auto serialver update-alternatives --install /usr/bin/wsgen wsgen /usr/lib/jvm/ia32-java-6-sun/bin/wsgen $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/wsgen.1.gz wsgen.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/wsgen.1.gz update-alternatives --auto wsgen update-alternatives --install /usr/bin/wsimport wsimport /usr/lib/jvm/ia32-java-6-sun/bin/wsimport $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/wsimport.1.gz wsimport.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/wsimport.1.gz update-alternatives --auto wsimport update-alternatives --install /usr/bin/xjc xjc /usr/lib/jvm/ia32-java-6-sun/bin/xjc $JAVA_PACKAGE_PRIORITY --slave /usr/share/man/man1/xjc.1.gz xjc.1.gz /usr/lib/jvm/ia32-java-6-sun/man/man1/xjc.1.gz update-alternatives --auto xjc update-alternatives --install /usr/lib/xulrunner-addons/plugins/javaplugin_oji.so xulrunner-addons-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto xulrunner-addons-javaplugin.so update-alternatives --install /usr/lib/firefox/plugins/javaplugin_oji.so firefox-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto firefox-javaplugin.so update-alternatives --install /usr/lib/iceape/plugins/javaplugin_oji.so iceape-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto iceape-javaplugin.so update-alternatives --install /usr/lib/iceweasel/plugins/javaplugin_oji.so iceweasel-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto iceweasel-javaplugin.so update-alternatives --install /usr/lib/mozilla/plugins/javaplugin_oji.so mozilla-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto mozilla-javaplugin.so update-alternatives --install /usr/lib/midbrowser/plugins/javaplugin_oji.so midbrowser-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto midbrowser-javaplugin.so update-alternatives --install /usr/lib/xulrunner/plugins/javaplugin_oji.so xulrunner-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto xulrunner-javaplugin.so update-alternatives --install /usr/lib/firefox-3.0/plugins/javaplugin_oji.so firefox-3.0-javaplugin.so /usr/lib/jvm/ia32-java-6-sun/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so $JAVA_PACKAGE_PRIORITY update-alternatives --auto firefox-3.0-javaplugin.so


To make this consistent with my /usr/lib/jvm/.ia32-java-6-sun.jinfo file, I changed it as well: