• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NoClassDefFoundError

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I was trying to run a demo program viz. DemoGUI
Compilation was fine and didn't give any warning or errors
while running it gave the following error
Exception in thread "main" java.lang.NoClassDefFoundError: DemoGUI (wrong name:
org/freehep/j3d/plot/test/DemoGUI)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
The location of DemoGui.java and DemoGUI.class is
D:\freehep-v1.1\src\org\freehep\j3d\plot\test
the variable
CLASSPATH=.;D:\jdk1.3.1_07;D:\freehep-v1.1\src
package and import stmts of the DemoGUI are as
package org.freehep.j3d.plot.test;
import org.freehep.j3d.plot.*;
import javax.swing.*;
import java.awt.*;
What could be done to run this prg.
Thanks in advance
 
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your source file is called DemoGui.java, yet the class file is DemoGUI.class, is it safe to assume you renamed your source file?
whatever your answer tho have a look in those directories, and start by deleting your class file, then rebuild and make sure your class goes to the directory you specified in the package statement
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Zali. Please take a look at JavaRanch's Naming Policy and change your displayed name accordingly. Thanks
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should also try using the package name along with the class name. For example
java org.freehep.j3d.plot.test.DemoGUI
Also be sure to use the correct capital letters in the class name. Your problem may be as simple as that, in fact.
Layne
 
Something must be done about this. Let's start by reading this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic