Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applets Vs. Netbeans

 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • 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 ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • 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
  • 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: 42968
73
  • Mark post as helpful
  • send pies
  • 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.
 
Pravin Jain
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks for that both of you: IT WORKED!
[ October 02, 2007: Message edited by: Sam Bluesman ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic