JSch is not included in jdk 1.7?

岁酱吖の 提交于 2019-12-13 10:26:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!