Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown


Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error when trying to run the file

C:\My Program Files\cTAKES\chunker\scripts\java\data\chunk\genia>java -cp . Geni

Exception in thread "main" java.lang.NoClassDefFoundError: Genia2PTB (wrong name
: data/chunk/genia/Genia2PTB)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)
at$ Source)
at Method)
at 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)

This is contents of the directory

C:\My Program Files\cTAKES\chunker\scripts\java\data\chunk\genia>dir
Volume in drive C has no label.
Volume Serial Number is 9883-718B

Directory of C:\My Program Files\cTAKES\chunker\scripts\java\data\chunk\genia

07/27/2009 03:16 PM <DIR> .
07/27/2009 03:16 PM <DIR> ..
07/27/2009 03:16 PM 552 Genia2PTB$1.class
07/27/2009 03:16 PM 1,755 Genia2PTB.class
03/15/2009 07:40 PM 2,579
3 File(s) 4,886 bytes
2 Dir(s) 37,659,451,392 bytes free

I have tried it with the -cp command and without. I don't have admin rights on the computer I'm using so I can't edit the System classpath. The directory I'm in has the file I'm trying to run. I have checked that and I thought putting the dot "." for the classpath would overwrite whatever is in the system classpath and just use the current directory. What am I doing wrong?
Posts: 70206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please have a look at the package/folder structure. Is it like this?If so, try going to the file marked XXX (which I think you have called "java" and try with
java -cp . data.chunk.genia.Genia2PTB

If you have declared a package structure in a .java file, then you need to invoke that class from outside its package structure with its fully-qualified name after "java" and "-cp ." You can get a hint of the package structure from the "wrong name" bit of the stack trace.
How do they get the deer to cross at the signs? Or to read this tiny ad?
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic