2012-05-18 160 views
2

我在使用netbeans将JApplet部署到正常工作的Web服务器时遇到问题。会发生什么似乎是加载小程序,但随后加载时,我只是留下一个空白的屏幕和没有按钮。我想这可能是因为我使用的是布局设计,或者是因为所需的库没有包含在.jar中。我正在使用Atmos包装函数和一些外部.jar文件。Java Applet Web部署问题

任何帮助将会很棒!如果您需要更多信息,请询问!

public void init() { 

    // initialise any variable we have created 
    cloud = new CloudClass(); 
    user = new User(); 
    sourceFiles = null; 
    dest = null; 

    /* 
    * Set the Nimbus look and feel 
    */ 
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> 
    /* 
    * If Nimbus (introduced in Java SE 6) is not available, stay with the 
    * default look and feel. For details see 
    * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
    */ 
    try { 
     for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 
      if ("Nimbus".equals(info.getName())) { 
       javax.swing.UIManager.setLookAndFeel(info.getClassName()); 
       break; 
      } 
     } 
    } catch (ClassNotFoundException ex) { 
     java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
    } catch (InstantiationException ex) { 
     java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
    } catch (IllegalAccessException ex) { 
     java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
    } catch (javax.swing.UnsupportedLookAndFeelException ex) { 
     java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
    } 
    //</editor-fold> 

    /* 
    * Create and display the applet 
    */ 
    try { 
     java.awt.EventQueue.invokeAndWait(new Runnable() { 

      public void run() { 
       // initialise any previously uninitialised variables 
       initComponents(); 
       invalidLogin_label.setVisible(false); 
      } 
     }); 
    } catch (Exception ex) { 
     ex.printStackTrace(); 
    } 
} 

编辑:我扭捏了一下周围,现在的小应用程序页面简单地与网页上的错误,说“错误,请为”出现

点击该说的COM/EMC/ESU/API/EsuException并单击详细信息按钮让我这可能是帮助所有的博学类型..

C语言带来的调试选项:清除控制台窗口 F:最终确定对象在结束队列 G:垃圾收集 h:显示此帮助消息 升:转储类加载器列表 米:打印内存使用 ○:触发的日志记录 问:隐藏控制台 R:重新加载策略配置 S:转储系统和部署属性 吨:转储线程列表 ν:转储线程堆栈 X :清除类载入缓存 0-5:设置跟踪级别

+2

1)确保每个catch都有一个'e.printStackTrace()'2)检查Java控制台的输出。 3)发布HTML,applet'init()'方法和一个链接到测试小程序作为对问题的编辑。 –

+0

不确定如何为测试小程序提供链接,我可以将您链接到我遵循的教程以创建Web应用程序 http://netbeans.org/kb/docs/web/applets.html –

+1

@MatthewPigram:有一件事遗漏了,在我看来,你没有签署你的.jar文件,所以它可以作为Java Web Start运行,他们在那里教你如何做到这一点? [如何签署.jar文件](http://frequal.com/java/SignAllAppletJars.html),可能不会帮助,但不确定这是问题的根源,但:( –

回答

2

两个可能的问题似乎最有可能的:

  • 没有被在类路径中需要的jar,因此它与某种爆炸错误。在这种情况下,您需要了解如何查看ClassNotFoundException并从那里解决它。
  • 加载后,您的UI不会刷新/正确布置。参见:Applet works, but swing components won't appear!
+0

即时通讯认为你在那里的第一个点是最有可能的,我用NetBeans GUI设计我的秋千组件,所以肯定所有的东西应该正常工作? –