2016-11-08 91 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