Search code examples
javaswingnetbeansjappletcardlayout

Java Applet Web deployment problems


I am having trouble deploying a JApplet using netbeans into a working web server. What happens is that it appears to load up the applet, but then upon loading I am simply left with a blank screen and no buttons. I am thinking that could either be because I am using a cardlayout design or because the libraries required are not being included in the .jar. I am using Atmos wrapper functions and a number of external .jar files.

Any help would be awesome! If you need more info please ask!

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();
    }
}

EDIT: I have tweaked around a bit and now the applet page simply comes up with an error on the webpage which says "Error, click for details"

Clicking on this says com/emc/esu/api/EsuException and clicking on the Details button gives me some debug options which may be of help to all the more knowledgeable types..

c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to


Solution

  • Two possible problems seem most likely:

    • The required jars aren't being found on the classpath, so it is exploding with some kind of error. In which case you'll need to find out how to view the ClassNotFoundException and resolve it from there.
    • Your UI isn't refreshing / getting laid out correctly after loading. See: Applet works, but swing components won't appear!