Using Chilkat for Java in Eclipse on Windows

Here are the steps I followed to use Chilkat’s Java library in an Eclipse project on Windows:

  1. Open Project->Properties, select “Java Build Path”, click on the “Add External JARs…” button and add the “chilkat.jar”
  2. (still within the Project Properties dialog) Click on the “Run/Debug Settings”, select your Java class, then click on the “Edit…” button.  Select the “Arguments” tab, then add  -Djava.library.path=”C:\chilkatJava;${env_var:PATH}” where “C:\chilkatJava” is the directory path containing the “chilkat.dll” file.
  3. The chilkat.dll is loaded at runtime using this code snippet:
	  static {
		    try {
		        System.loadLibrary("chilkat");
		    } catch (UnsatisfiedLinkError e) {
		      System.err.println("Native code library failed to load.\n" + e);
		      System.exit(1);
		    }
		  }
Tags :