Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 29th, 2004, 07:39 PM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default NoClassDefFoundError

I coded a small application in Netbeans, and used the AbsoluteLayout it provides for designing the GUI. Everything compiles and runs fine within Netbeans, but after I JAR the project and try to execute it a NoClassDefFoundError is thrown. The exact error looks like this:

java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout

I don't have much experience with JARing, and this is the first application I've wrote with Netbeans, so I'm a bit lost as to why this is occuring. The manifest is written correctly, and I can see the the program begins execution, but this error is thrown when exected as a JAR.

Any idea how this problem can be fixed? Is there a way to include the missing class definitions with the JAR?
 
Old January 30th, 2004, 11:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try the following:

java -cp app.jar MainClass

Cheers

Martyn
 
Old January 30th, 2004, 11:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Crava,

Sun do a quick jar tutorial that might help you out:

http://java.sun.com/docs/books/tutorial/jar/

Cheers

Martyn
 
Old January 30th, 2004, 12:48 PM
Registered User
 
Join Date: Jan 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Aha, thanks for your advice!

But I did find a better way I think. Rather than include the class defs for the AbsoluteLayout with the jar, the Netbeans people suggest that you convert the GUI to a grid bag layout when distributing. So, by changing the big container JFrame to grid bag, and all smaller frames to null layout, I have an identical UI without the need for the absolute layout which everything was designed in.

If you want to see how it turned out, take a look here!

http://members.shaw.ca/webspacefordrit/pet/

It's a simple game, but people seem to enjoy it. Read the how-to if you're unsure how to play and need clarification!






Similar Threads
Thread Thread Starter Forum Replies Last Post
java.lang.NoClassDefFoundError when trying to crea Nimeshkd EJB 2 July 12th, 2012 01:30 AM
Help with JAXP (NoClassDefFoundError) Satyajit Sahu XSLT 1 July 13th, 2007 03:53 AM
Exception : java.lang.NoClassDefFoundError haifriends J2EE 1 July 26th, 2006 07:22 PM
NoClassDefFoundError: javax/mail/MessagingExceptio rida BOOK: Beginning Cryptography with Java 7 May 28th, 2006 08:07 PM
Java NoClassDefFoundError wireblock JSP Basics 1 August 19th, 2003 01:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.