aspose file tools*
The moose likes Java in General and the fly likes jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar file" Watch "jar file" New topic
Author

jar file

Barry Higgins
Ranch Hand

Joined: Jun 05, 2003
Posts: 89
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
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1821

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.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Barry Higgins
Ranch Hand

Joined: Jun 05, 2003
Posts: 89
Thanks Joel,
I can't believe I missed that one!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar file