Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/05/2010, 05:47
Avatar de FiruzzZ
FiruzzZ
 
Fecha de Ingreso: diciembre-2007
Ubicación: en casa
Mensajes: 470
Antigüedad: 16 años, 5 meses
Puntos: 41
Respuesta: Saber cuando el programa fue SUPRIMIDO

tengo una duda sobre tu código..
el psvm (public static void main) debería NO arrojar nunca ningún tipo de exception?.. ya que supone ser la 1er y última instancia de un objeto, y estas exception no se pueden atrapar

volviendo a mi duda.. me tira este error

Exception in thread "main" java.lang.RuntimeException
at jgestion.Main.main(Main.java:35)
[TopLink Info]: 2010.05.10 08:38:35.359--ServerSession(31476927)--TopLink, version: Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))
[TopLink Info]: 2010.05.10 08:38:35.921--ServerSession(31476927)--file:/D:/777/NetBeansProjects/JGestion/build/classes/-JGestionPU login successful
Exception in thread "AWT-Windows" java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(Application ShutdownHooks.java:39)
at java.lang.Runtime.addShutdownHook(Runtime.java:192 )
at sun.awt.windows.WToolkit.run(WToolkit.java:277)
at java.lang.Thread.run(Thread.java:619)

Este es mi código:

Código C++:
Ver original
  1. public static void main(String[] args) {
  2.       Thread shutdownThread = new Thread() {
  3.          @Override
  4.          public void run() {
  5.             if (DAO.getEntityManager().isOpen()) {
  6.                java.awt.EventQueue.invokeLater(new Runnable() {
  7.  
  8.                   public void run() {
  9.                      new gui.JFP().setVisible(true);
  10.                   }
  11.                });
  12.             }
  13.             System.out.println("Esto se imprimirá antes de que la maquina virtual finalice");
  14.          }
  15.       };
  16.       Runtime.getRuntime().addShutdownHook(shutdownThread);
  17.       throw new RuntimeException();