It's not a secret anymore!*
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "jar file" Watch "jar file" New topic
Author

jar file

joe moe
Greenhorn

Joined: Aug 04, 2010
Posts: 2
Hi, I am getting this error below. I am trying to jar a file. Not sure what to do. The error points to an error in line number 55 of SendFiles, but I know this line is fine there. It has something to do with jaring the file.
Thanks,
Keith


java -jar SendFiles.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/sshtools/j2ssh/transport/HostKeyVerification
at SendFiles.main(SendFiles.java:55)
Caused by: java.lang.ClassNotFoundException: com.sshtools.j2ssh.transport.HostKeyVerification
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 1 more
keith@keith-desktop:~/workspace/Trial2/bin$ java -jar SendFiles.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/sshtools/j2ssh/transport/HostKeyVerification
Mathew Lee
Ranch Hand

Joined: Jun 08, 2009
Posts: 238
sometimes i observed the line number it refers is next line than actual line where the error occured.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

That class isn't in the jar, and the jar's manifest doesn't point to any other jar which contains it either. Talk to the person who created the jar file in the first place and ask them about whether there are other jars which go along with it, and if so where they should be put.
joe moe
Greenhorn

Joined: Aug 04, 2010
Posts: 2
I have checked my jar file and it has this file AlwaysAllowingConsoleKnownHostsKeyVerification.class. So it seems that the jar file is pointing at the appropriate jars. Not sure what else to do.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure what makes you think that's what you need; you need the class/interface it says is missing, not some other one.

Is the j2ssh stuff on the classpath?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jar file
 
Similar Threads
Ant - How to create a runnable jar of jars and classes
jar error
package javax.servlet.http does not exist
java.lang.NoClassDefFoundError
error