Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Applets Vs. Netbeans

 
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I went through the tutorial at:

http://www.netbeans.org/kb/50/tutorial-applets.html

Creating an applet using the code examples is fine. However, If I try to create a GUI using the Applet form design My applets does not deploy in the web browser properly (I have tried both IE and firefox)



If I try to run this in a web browser then I just get a cross where the applet should load. what I am doing wrong?

Thanks
[ October 01, 2007: Message edited by: Ulf Dittmer ]
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does the applet tag in the HTML look like? Are the classes in the same directory as the HTML file, including the org.jdesktop library? Are there any messages in the Java Console?
[ October 01, 2007: Message edited by: Ulf Dittmer ]
 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. Let me start again.

Here is the code (slightly updated than before)



This is the html applet tag:

<applet code="org.me.Program" archive="HelloApplet2.jar"/>



The output of the Java console is:

java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


I have the layout extensions library containing the jDesktop library in the libraries directory of the Web Application (shown when using the Project view) and I also have it as part of the Libraries directory of the project I initally created the applet in.

Any ideas?

Thanks

[ October 01, 2007: Message edited by: Sam Bluesman ]
[ October 01, 2007: Message edited by: Ulf Dittmer ]
 
Ulf Dittmer
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The applet doesn't have access to either the WEB-INF/lib directory nor whatever directory NetBeans uses (apparently Libraries, according to your description). Those jars need to be in the same place HelloApplet2.jar is in, and they need to be referenced in the archive tag.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sam Bluesman:
OK. Let me start again.

Here is the code (slightly updated than before)



This is the html applet tag:

<applet code="org.me.Program" archive="HelloApplet2.jar"/>



The output of the Java console is:

java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


I have the layout extensions library containing the jDesktop library in the libraries directory of the Web Application (shown when using the Project view) and I also have it as part of the Libraries directory of the project I initally created the applet in.

Any ideas?

Thanks

[ October 01, 2007: Message edited by: Sam Bluesman ]

[ October 01, 2007: Message edited by: Ulf Dittmer ]



keep the jar in the same directory as your html file.
 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that both of you: IT WORKED!
[ October 02, 2007: Message edited by: Sam Bluesman ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic