Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running a jar file from command line

494490Oct 12 2009 — edited Oct 13 2009
I thought I was past classpath/compilation issues but I guess not. I am trying to run an SFTP program that requires the SFTP jar from JCraft. All the necessary files are in the same directory and include: sendSftp.class, jsch-0.1.40.jar, and sendSftp.properties. The class file was created by explicitly listing the path for all files that were needed and it was successful. However I have not found the correct combination when trying to run the jar that was successfully created using the same files. I used:jar cfm test.jar Manifest.txt jsch-0.1.40.jar sendSftp.class sendSftp.properties to create test.jar. My Manifest.txt just contains the entry point 'Main-Class: sendSftp' and a carriage return. My class is not part of a package.

I have tried what is listed in the tutorial 'java -jar sendSftp sendSftp.properties' but I get:
Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch
at sendSftp.send(sendSftp.java:32)
at sendSftp.main(sendSftp.java:119)

The class runs successfully from the command line, but I cannot make the jar work.

Within my sendSftp.java I am importing the Jcraft jar with 'import com.jcraft.jsch.*;'. Can someone point me in the right direction?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 10 2009
Added on Oct 12 2009
7 comments
1,151 views