2016-11-08 6 views
-3

Ich habe ein Java-Projekt entwickelt, wo ich einen SSH-Tunnel erstellen muss. Ich benutze chilkat Bibliothek für den Zweck. Ich habe es erfolgreich in meinem Projektordner installiert. Hier ist das Code-Snippet. Aber ich bekomme einen Fehler, der sagt:import com.chilkatsoft. * Nicht gelöst

importieren Sie com.chilkatsoft. * Nicht behoben.

Der Code ist:

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

Kann jemand bitte helfen Sie mir das Problem beheben?

+0

Haben Sie versucht, 'Import com.chilkat *;'.? – Swagin9

+0

Ja. Aber es zeigt den gleichen Fehler. – Preety

Antwort

2

Haben Sie Ihre Systemeigenschaft java.library.path richtig eingestellt? Wie:

java -Djava.library.path=yourPath yourApp 

Oder einfach laden alle den Pfad direkt:

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

Ich habe ausgewählt Projekt-> Eigenschaften-> Java-Build-Pfad-> externe Krug hinzufügen und die chilkat.jar hinzugefügt. Weiter Unter Konfiguration bearbeiten habe ich Djava.library.path = "C: \ chilkatJava; $ {env_var: PATH}" zur Registerkarte "Argumente" hinzugefügt. – Preety

Verwandte Themen