• 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

jar file

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,
I'm having a bit of a problem here and I hoping someone can help with.
I've got my class file (which now contains little more than a hello world statment!) and my manifest
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.5.3
Created-By: 1.4.0_02-b02 (Sun Microsystems Inc.)
Main-Class: WEB-INF/classes/newsfeed_upload/action/newsfeedUpload
however when I try to access the jar file
containing them, calling
java -jar newsfeed_upload.jar I get this exception:
Exception in thread "main" java.lang.NoClassDefFoundError: WEB-INF/classes/newsf
eed_upload/action/newsfeedUpload (wrong name: newsfeed_upload/action/newsfeedUpl
oad)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
Thanks v. much,
Baz
 
Bartender
Posts: 1844
Eclipse IDE Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two things:
1). Unless WEB-INF/classes is part of the package name of your class (and odds are 99.9999% that they aren't), then you should not specify them in the class name. You class name should not be a path, but rather the fully-qualified class name (newsfeed_upload.action.newsfeedUpload).
2). Your jar structure should be {ROOT}/newsfeed_upload/action/newsfeedUpload.class
If you have the WEB-INF and classes directory in there (which I am assuming that you are, based on how you structured your Main-Class attribute) your class will not be found.
 
Barry Higgins
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Joel,
I can't believe I missed that one!
reply
    Bookmark Topic Watch Topic
  • New Topic