简体   繁体   中英

JSch is not included in jdk 1.7?

I was trying to use JSch to connect to a mysql via ssh. According to JSch website, http://www.jcraft.com/jsch/ it should work with j2se 1.4 and up, "no additional libraries required". I have jdk 1.7 installed. Howver got the error saying "package com.jcraft.jsch does not exist, import com.jcraft.jsch.JSch;" when I compiled my java code. I wonder how to get it to work.

Usually, "no additional libraries required" implies "except for our library." It is not uncommon to use a library that then requires twenty other libraries (which is why tools like maven exist and are used everywhere).

Try downloading the jsch jar and including it in your classpath, and I bet the error will go away.

Add the JSch JAR in the application "lib" folder.

Or update your system class path with JSch.JAR

in Windows

Go to

Advance System settings --> Advanced (tab) --> Environment Variables --> User Variables 

Add

CLASSPATH = %CLASSPATH%;C:\LOCATION OF THE JAR\JSch.jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM