Deploy applet with JNLP file load wrong package

Discussion in 'Java' started by SamuelXiao, Jan 20, 2011.

  1. SamuelXiao

    SamuelXiao Guest

    Hi all, I am deploying an applet containing a jnlp file. I follow the
    instructions from
    http://download.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
    it is work when I tried its sample, however, when I changed the
    AppletPage.html and xxx-applet.jnlp with my applet, it always loads
    the wrong package and I am sure my code was compiled correctly.

    From the oracle sample, it has 3 html which 2 with using JNLP while 1
    using no JNLP. I can successfully run the applet (so I'm sure the jar
    is correct) with no jnlp for my own program. But for the html using
    jnlp, it always load the wrong package and results in classNoFound.
    Below is the error from java console.

    Java Plug-in 1.6.0_22
    applets.MonopolyEntry。
    java.lang.ClassNotFoundException: applets.MonopolyEntry
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown
    Source)
    at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager
    $AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Exception:java.lang.ClassNotFoundException: applets.MonopolyEntry

    My MonopolyEntry.class is under applet (no 's') folder instead of
    applets folder, I tried restart the PC, clear the cache and so on, but
    still has this error. Does anyone has any idea?

    my jnlp:

    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
    <information>
    <title>Simple Monopoly Board Game demo</title>
    </information>
    <resources>
    <!-- Application Resources -->
    <j2se version="1.6+"
    href="http://java.sun.com/products/autodl/j2se" />
    <jar href="MonopolyDemo.jar" main="true"/>
    <jar href="log4j-1.2.16.jar"/>

    </resources>
    <applet-desc
    name="Monopoly Board Game Applet"
    main-class="applet.MonopolyEntry"
    width="400"
    height="400">
    </applet-desc>
    <update check="alwyas" policy="always"/>
    </jnlp>

    and my html:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Simple Monopoly Board Game Demo Page</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=windows-1252">
    </head>
    <body>
    <h1>Monopoly Board Game Applet demo </h1>

    <script src="http://www.java.com/js/deployJava.js"></script>
    <script>
    var attributes = { code:'applet.MonopolyEntry.class',
    archive:'MonopolyDemo.jar,log4j-1.2.16.jar', width:400, height:
    400} ;
    var parameters = {jnlp_href: 'monopolyentry-applet.jnlp'} ;
    deployJava.runApplet(attributes, parameters, '1.6');
    </script>

    <!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** --
    >

    <!-- Below code will send the info to Omniture server -->
    <script language="javascript">var
    s_code=s.t();if(s_code)document.write(s_code)</script>

    <!-- End SiteCatalyst code -->
    </body>
    </html>

    any help would be highly appreciated!
    SamuelXiao, Jan 20, 2011
    #1
    1. Advertising

  2. SamuelXiao

    Lew Guest

    SamuelXiao wrote:
    > Hi all, I am deploying an applet containing a jnlp file. I follow the
    > instructions from http://download.oracle.com/javase/tutorial/deployment/applet/deployin...
    > it is work when I tried its sample, however, when I changed the
    > AppletPage.html and xxx-applet.jnlp with my applet, it always loads
    > the wrong package and I am sure my code was compiled correctly.
    >
    > But for the html using
    > jnlp, it always load the wrong package and results in classNoFound [sic].
    > Below is the error from java console.
    >
    > Java Plug-in 1.6.0_22
    > applets.MonopolyEntry。
    > java.lang.ClassNotFoundException: applets.MonopolyEntry
    >         at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    >         at java.security.AccessController.doPrivileged(Native Method)
    >         at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown
    > Source)
    >         at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
    >         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    >         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    >         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    >         at java.lang.ClassLoader.loadClass(Unknown Source)
    >         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    >         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    >         at sun.plugin2.applet.Plugin2Manager
    > $AppletExecutionRunnable.run(Unknown Source)
    >         at java.lang.Thread.run(Unknown Source)
    > Exception:java.lang.ClassNotFoundException: applets.MonopolyEntry
    >
    > My MonopolyEntry.class is under applet (no 's') folder instead of
    > applets folder,
    >


    There's your trouble right there. The program is asking for
    'applets.MonopolyEntry' but you don't have any such class.

    What is the 'package' declaration inside MonopolyEntry.java?

    What code is trying to refer to 'applets.MonopolyEntry'? (Hint: Use
    your editor's "Find" command.)

    --
    Lew
    Lew, Jan 20, 2011
    #2
    1. Advertising

  3. SamuelXiao

    SamuelXiao Guest

    On Jan 21, 1:42 am, Lew <> wrote:
    > SamuelXiao wrote:
    > > Hi all, I am deploying an applet containing a jnlp file. I follow the
    > > instructions fromhttp://download.oracle.com/javase/tutorial/deployment/applet/deployin...
    > > it is work when I tried its sample, however, when I changed the
    > > AppletPage.html and xxx-applet.jnlp with my applet, it always loads
    > > the wrong package and I am sure my code was compiled correctly.

    >
    > > But for the html using
    > > jnlp, it always load the wrong package and results in classNoFound [sic].
    > > Below is the error from java console.

    >
    > > Java Plug-in 1.6.0_22
    > > applets.MonopolyEntry。
    > > java.lang.ClassNotFoundException: applets.MonopolyEntry
    > >         at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    > >         at java.security.AccessController.doPrivileged(Native Method)
    > >         at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown
    > > Source)
    > >         at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
    > >         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    > >         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    > >         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    > >         at java.lang.ClassLoader.loadClass(Unknown Source)
    > >         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
    > >         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    > >         at sun.plugin2.applet.Plugin2Manager
    > > $AppletExecutionRunnable.run(Unknown Source)
    > >         at java.lang.Thread.run(Unknown Source)
    > > Exception:java.lang.ClassNotFoundException: applets.MonopolyEntry

    >
    > > My MonopolyEntry.class is under applet (no 's') folder instead of
    > > applets folder,

    >
    > There's your trouble right there.  The program is asking for
    > 'applets.MonopolyEntry' but you don't have any such class.
    >
    > What is the 'package' declaration inside MonopolyEntry.java?
    >
    > What code is trying to refer to 'applets.MonopolyEntry'?  (Hint: Use
    > your editor's "Find" command.)
    >
    > --
    > Lew


    Thanks, the issue has been resolved.
    SamuelXiao, Jan 21, 2011
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Krista
    Replies:
    3
    Views:
    2,302
    Andrew Thompson
    Sep 15, 2004
  2. Carl Burke
    Replies:
    1
    Views:
    2,109
    Andrew Thompson
    Jan 6, 2006
  3. Qu0ll
    Replies:
    8
    Views:
    1,358
    Wojtek
    Aug 11, 2009
  4. Qu0ll
    Replies:
    7
    Views:
    809
    Roedy Green
    Aug 19, 2009
  5. Roedy Green
    Replies:
    4
    Views:
    1,346
    Andrew Thompson
    Feb 27, 2010
Loading...

Share This Page