| gclib 450 Communications API for Galil controllers and PLCs |

Java

gclib uses the venerable

Java Native Access (JNA) library to simplify integration into the Java Native Interface (JNI).

Attention
  This is the initial version of the the gclib Java wrapper. As such, GclibJava ships as source files, not the compiled jar files. All functions are subject to change in future releases of gclib. Java hackers with recommendations on how to make this library better are encouraged to email softw.nosp@m.ares.nosp@m.uppor.nosp@m.t@ga.nosp@m.lil.c.nosp@m.om. Somebody has to teach those Galil Java noobs what's what.

## Windows

The following instructions were performed with 64 bit Windows 7 on Oracle NetBeans IDE 8.2 and Java 1.8.0_131.

For brevity, these instructions assume the default gclib installation location of "C:\Program Files (x86)\Galil\gclib".

### Step-by-Step

1. Install gclib with 64 bit binaries (default install).
2. Install 64 bit NetBeans and Java, jdk-8u131-nb-8_2-windows-x64.exe.
3. Launch NetBeans.
4. Create a new application.
   1. File | New Project...
   2. Under Categories, select Java.
   3. Under Projects, select Java Application.
   4. Click Next.
   5. Type `GclibTest` for the Project Name.
   6. Note the location of the Project Folder.
   7. Uncheck Create Main Class
   8. Click Finish
5. Open the Project Folder as noted above.
6. Open the src directory in the Project Folder location.
7. Copy the whole directory C:\Program Files (x86)\Galil\gclib\examples\java\gclibtest to this directory.
8. Copy the whole directory C:\Program Files (x86)\Galil\gclib\source\wrappers\java\gclibjava to this directory.
9. Create a directory at `c:\jna\`.
   - Another directory may be chosen. The purpose of this directory is to hold jna's jar binary for the Java classpath.
10. Download a copy of jna.jar to the new directory.
    - https://github.com/java-native-access/jna#download
    - This example uses jna-4.4.0.jar.
11. In the NetBeans Projects tab, expand GclibTest.
12. Right-click on Libraries and choose Add JAR/Folder....
13. Navigate to the jna.jar saved above. Click Open to add jna.jar to the classpath.
14. In the NetBeans Projects tab, right-click on GclibTest and choose Properties.
15. Choose the Run item out of the Categories options tree.
16. In the Main Class text box, type `gclibtest.GclibTest`. Click OK.
17. In the NetBeans Projects tab, expand GclibTest | Source Packages | gclibtest.
18. Double click GclibTest.java, and find the line containing `gclib.GOpen`.
19. Update the address for the desired hardware.
20. Choose Run | Run Project (GclibTest) or hit the `F6` key to run the application.
21. The appplication output will print in the NetBeans Output window.

### Documentation

The GclibJava class has helpful documentation for developing a Java application. Use the following instructions to create the Javadoc.

1. In the NetBeans Projects tab, right-click GclibTest.
2. Choose Generate Javadoc to create the documentation and open it in the system's default browser.