Implementing in Eclipse Galileo
To use the AdsToJava.dll in the current Eclipse project, the TcJavaToAds.jar must be added to it. This article shows how to add the library and what imports are needed from it (please note that the instructions may need to be slightly varied on your system if the version you are using is different from this one):
First, Eclipse must be started and a new project created. After that please navigate to the "Package Explorer" and right click on your new project. In the menu that opens, select "Properties".
In the next step, select the "Java Build Path" category and click the "Add External JARs..." button. In the file browser that appears, locate the TcJavaToAds.jar file.
It is located in the "TwinCAT\ADS Api\AdsToJava" directory.
Finally, the packages whose components you want to use must be imported. For this purpose you can find documented sample programs in the Information System.
import de.beckhoff.jni.AdsConstants;
import de.beckhoff.jni.Convert;
import de.beckhoff.jni.JNIByteBuffer;
import de.beckhoff.jni.JNILong;
import de.beckhoff.jni.JNIBool;
import de.beckhoff.jni.tcads.AdsCallDllFunction;
import de.beckhoff.jni.tcads.AdsCallbackObject;
import de.beckhoff.jni.tcads.AdsDevName;
import de.beckhoff.jni.tcads.AdsNotificationAttrib;
import de.beckhoff.jni.tcads.AdsNotificationHeader;
import de.beckhoff.jni.tcads.AdsState;
import de.beckhoff.jni.tcads.AdsSymbolEntry;
import de.beckhoff.jni.tcads.AdsVersion;
import de.beckhoff.jni.tcads.AmsAddr;
import de.beckhoff.jni.tcads.AmsNetId;
import de.beckhoff.jni.tcads.CallbackListenerAdsRouter;
import de.beckhoff.jni.tcads.CallbackListenerAdsState;