Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-18-2008, 10:48 AM
Member
 
Join Date: Feb 2008
Posts: 23
jon80 is on a distinguished road
NoClassDefFoundError
....why doesn't this compile?

TestOne.java
--------------
public class TestOne {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int x = 0;
//assert (x != 500); should break
x = 500;
}

}

Error:
-----
Exception in thread "main" java.lang.NoClassDefFoundError: TestOne
Caused by: java.lang.ClassNotFoundException: TestOne
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
Press any key to continue . . .

Last edited by jon80 : 05-18-2008 at 10:49 AM. Reason: update #1
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-18-2008, 11:04 AM
danielstoner's Avatar
Senior Member
 
Join Date: Apr 2008
Location: Canada
Posts: 191
danielstoner is on a distinguished road
It does compile and run! What do you mean? Where do you try to compile/run it? Provide more information about the cintext.
__________________
Daniel @ [
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
]
Language is froth on the surface of thought
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-18-2008, 12:44 PM
Member
 
Join Date: Feb 2008
Posts: 23
jon80 is on a distinguished road
hmm...it did not run somehow on my laptop, although now it ran on one of my virtual machines. Both machines run WinXP and have Java 1.6.

It is noted that the error reappeared when using the -enableassertion flag:

C:\Documents and Settings\Administrator.SERVER02\Desktop>java -enableassertions
TestOne
Exception in thread "main" java.lang.NoClassDefFoundError: TestOne
Caused by: java.lang.ClassNotFoundException: TestOne
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

C:\Documents and Settings\Administrator.SERVER02\Desktop>

Last edited by jon80 : 05-18-2008 at 12:58 PM. Reason: update #1
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-18-2008, 02:20 PM
Member
 
Join Date: Dec 2007
Posts: 17
Jman is on a distinguished road
I had no problems compiling the code.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
java.lang.NoClassDefFoundError: com.ibm.ws.orb.GlobalORBFactory hawkeye Enterprise JavaBeans 1 06-16-2008 12:56 PM
java.lang.NoClassDefFoundError J_a_y New To Java 2 08-07-2007 01:51 PM
java.lang.NoClassDefFoundError fred Advanced Java 3 08-01-2007 07:00 PM
NoClassDefFoundError: org/hibernate/Session simon Database 3 08-01-2007 06:34 PM
java.lang.NoClassDefFoundError: javax/activation/DataSource bbq Advanced Java 1 07-05-2007 06:26 AM


All times are GMT +3. The time now is 03:00 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org