-3

我一直在开发一个需要创建 ssh 隧道的 java 项目。我为此目的使用 chilkat 库。我已将其成功安装在我的项目文件夹中。这是代码片段。但我收到一条错误消息:

导入 com.chilkatsoft.* 未解决。

代码是:

package usingchilkat;

import com.chilkatsoft.*;

public class myclass {
static {
       try{
           System.loadLibrary("chilkat");
       ``  } catch (UnsatisfiedLinkError e) {
            System.err.println("Native code library failed to load.\n" + e);
            System.exit(1);
          }
        }

        public static void main(String argv[])
        {
        //  Important: It is helpful to send the contents of the
        //  ssh.LastErrorText property when requesting support.

            CkSshUnnel ssh = new CkSsh();
            boolean success = ssh.UnlockComponent("Anything");
            if (success != true) {
              System.out.println(ssh.lastErrorText());
              return;}
           }

任何人都可以帮我解决它吗?

4

1 回答 1

2

您是否正确设置了java.library.path系统属性?喜欢:

java -Djava.library.path=yourPath yourApp

或者直接加载所有路径:

System.load("c:/yourPath/chilkat.dll");
于 2016-11-08T14:32:05.360 回答