2016-11-08 92 views
-3

我一直在开发一个java项目,我需要创建一个ssh隧道。我正在使用chilkat库来达到这个目的。我已经在我的项目文件夹中成功安装了它。这是代码片段。 但我收到错误说:import com.chilkatsoft。*未解决

import com.chilkatsoft。* not resolved。

的代码是:

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;} 
      } 

谁能帮我解决这个问题?

+0

您是否尝试过'进口com.chilkat *;'? – Swagin9

+0

是的。但它显示了同样的错误。 – Preety

回答

2

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

java -Djava.library.path=yourPath yourApp 

或者干脆直接加载所有的路径:

System.load("c:/yourPath/chilkat.dll"); 
+0

我选择了project-> properties-> java build path->添加外部jar并添加了chilkat.jar。 Next在Edit配置中,我将Djava.library.path =“C:\ chilkatJava; $ {env_var:PATH}”添加到Arguments选项卡。 – Preety