0

I am using Netbeans 7.3, JRE 1.7.0_11, Java SE 7 update 40, on Mac 10.8.5.

I have created a JApplet GUI form which I have embedded in a applet tag within a HTML doc, which I have created in a Java Wed application.

When I try to run in Safari I get the following error:

java.lang.NoClassDefFoundError org/jdesktop/layout/GroupLayout$Group 

I have searched the net, it seems a common issue, ive found that some people resolved this error by changing :

Preferences-Java-GUI Builder - Layout Generation Style from Automatic to Swing Layout Extension Library. (from Automatic) & also tried importing swing.groupLayout but netbeans flags as a unused import.

But I am still getting the same error. Any feedback appreciated.

I have also posted this same question on code ranch and submitted it to netbeans forum but have had no luck to date.

Update: So scratched that for now idea for now and tried a basic app with a simple paint method that paints 'Hello', did not load on a Mac OS 10.8 and on windows 7 got the following error:

Exception in thread "AWT-EventQueue-2"
java.lang.IllegalStateException: Applet's parent container not set up
at sun.plugin2.applet.Plugin2Manager.start(Unknown Source)
at sun.plugin2.main.client.PluginMain$StartAppletRunner.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Update: Confirmed these basic applets are working on other PCs on all browsers so it has to be the settings of my own Mac 10.8, i have already check the security settings for java and they are set a medium, any ideas?

dancingbush
  • 2,131
  • 5
  • 30
  • 66
  • `GroupLayout` was introduced into the JSE in Java 6. There is no need to use the `org.jdesktop` class since that time. – Andrew Thompson Sep 30 '13 at 07:16
  • 1
    Why code an applet? If it is due to spec. by teacher, please refer them to [Why CS teachers should stop teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/). – Andrew Thompson Sep 30 '13 at 07:16
  • Yep it's req as assignment, i ended up coding the GUI instead of using a JApplet form but that did not work either. For now i just did the sane thing in javascript and got what i needed, but am puzzled at why i could not get applet to load – dancingbush Sep 30 '13 at 19:03
  • The GUI form generated from netbeans appears to use the org.jdesktop class, so im not really following your comment te grouplayout – dancingbush Sep 30 '13 at 19:19

1 Answers1

0

As the other post indicated, AjaxSwing supports all layouts (because it simply reads components coordinates).

If you get NoClassDefFoundError that means you haven't copied the .jar files to the right directory. You can either copy it to a directory on AjaxSwing CLASSPATH or specify them via agent.classPath. See documentation for more information.

sunysen
  • 2,265
  • 1
  • 12
  • 13