问题
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.
回答1:
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
回答2:
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.
来源:https://stackoverflow.com/questions/25690600/jsch-is-not-included-in-jdk-1-7