Eclipse SDK comes bundles with Java development tools and a built-in Java compiler, suitable for code writing, analysis and advanced refactoring techniques. In addition, Eclipse SDK uses widgets, implemented using the SWT technology. Eclipse SDK's GUI layer is called Jface and greatly simplifies the construction os SWT based tools. Java 2 Platform Standard Edition (J2SE) software is the premier platform for rapidly developing and deploying secure, portable applications that run on server and desktop systems.
The Leap Motion Java SDK uses a standard Jar file for Leap Motion API class definitions and a set of native libraries that allow your Leap-enabled Java programs to exchange data with the Leap. Setting up a Java project typically involves adding the LeapJava.jar file to your application’s classpath and setting the JVM library path parameter so that your JVM can find the native libraries.
Leap Motion Java libraries¶
The Leap Motion Jar file is cross-platform, but the native libraries must match the platform and architecture of the JVM used to run the program.
To use the Leap Motion SDK in a Java program, you must add the LeapJava.jar file to the classpath and set the java.library.path to the location of the Leap Motion native libraries.
Use the following Java and native libraries with the Leap Motion Java SDK:
- 32-bit Windows:
- LeapSDK/lib/LeapJava.jar — Leap Motion Java API class definitions
- LeapSDK/lib/x86/LeapJava.dll — 32-bit Leap Motion Java library for Windows
- LeapSDK/lib/x86/Leap.dll — 32-bit Leap Motion library for Windows
- 64-bit Windows:
- LeapSDK/lib/LeapJava.jar — Leap Motion Java API class definitions
- LeapSDK/lib/x64/LeapJava.dll — 64-bit Leap Motion Java library for Windows
- LeapSDK/lib/x64/Leap.dll — 64-bit Leap Motion library for Windows
- 32- or 64-bit Mac OS:
- LeapSDK/lib/LeapJava.jar — Leap Motion Java API class definitions
- LeapSDK/lib/libLeapJava.dylib — Leap Motion Java library for Mac
- LeapSDK/lib/libLeap.dylib — Leap Motion library for Mac
Compile from the command line¶
Use the Java compiler, javac to compile, setting the classpath option to specify the LeapJar file. For example, to compile the Sample.java program included in the Leap Motion SDK, you could use the following command:
(where <LeapSDK> is the location of your Leap Motion SDK folder.)
Run from the command line¶
Java 2 Sdk Mac Os
To launch a Leap-enabled program, Java needs to find the Leap Motion native libraries at runtime. LeapJava.jar must also be on the classpath. You can set Java’s java.library.path parameter to identify the native library. The command line syntax is slightly different between Mac and Windows. More importantly, on Windows, you have to specify either the 32-bit or the 64-bit libraries to match the architecture of the JVM you are using.
On Mac, you could run the Sample program using the following command:
On Windows, you could run the Sample program using a 64-bit JVM with the following command:
Eclipse¶
In the Eclipse IDE, you add the LeapJava.jar file to a project as an external Jar and then set the path to the appropriate native Leap Motion libraries as a property of the Jar file.
- Select New > Java Project from the Eclipse File menu.
- Assign a name to the project on the Create Java Project page and set other properties as desired. (The Leap Motion SDK supports Java 6 and 7.)
- Click Next to advance to the Java Settings page.
- Select the Libraries tab.
- Click the Add External Jars... button.
- Navigate to the LeapJava.jar file.
- Click Open to add LeapJava.jar to the project.
- Next, click the small triangle in front of the LeapJava.jar entry in the library list to reveal the library properties.
- Select the Native library location item.
- Click the Edit button.
- Navigate to the folder containing the Leap Motion native libraries.
On Windows, be sure to select the folder containing the correct libraries for your target architecture. If you are targeting a 32-bit JVM, use the Leap Motion libraries in the x86 folder of the SDK. If you are targeting a 64-bit JVM, use the libraries in the x64 folder. On Mac, each Leap Motion library file supports both architectures.
- Click Ok to set the path.
Note: you can also add the Leap Motion libraries to an existing project from the Project Properties dialog.
IntelliJ¶
In the IntelliJ IDE, you add the LeapJava.jar file to a project as a library. You separately set the path to the Leap Motion native libraries using the JVM parameter, java.library.path. The JVM parameters can be set using an IntelliJ Run/Debug configuration.
To add LeapJava.jar to the project:
- After creating a project in the usual way, select the File > Project Structure menu command to open the settings dialog.
- Click Libraries under project settings.
- Click the small + button at the top of the library list to open the Select Library Files dialog.
- Add LeapJava.jar from your Leap Motion SDK.
To set the path to the native Leap Motion libraries by creating a Run/Debug configuration:
- Select the Run > Edit Configurations… menu command.
- Click the small + button above the Configuration list.
- Choose Application to create a new application configuration.
- Assign a name.
- Set the VM Options field to set the -Djava.library.path parameter to the path to the proper folder containing the Leap Motion native libraries.
- Click Ok.
On Windows, be sure to select the folder containing the correct libraries for your target architecture. If you are targeting a 32-bit JVM, use the Leap Motion libraries in the x86 folder of the SDK. If you are targeting a 64-bit JVM, use the libraries in the x64 folder. On Mac, each Leap Motion library file supports both architectures.
NetBeans¶
In the NetBeans IDE, you add the LeapJava.jar file to a project as a library. You separately set the path to the Leap Motion native libraries using the JVM parameter, java.library.path. The JVM parameters can be set using a NetBeans Run configuration.
Java 2 Sdk Mac Download
To add the LeapJava.jar to a project and set the path to the native libraries:
- After creating a project in the usual way, select the File > Project Properties menu command to open the Project Properties dialog.
- Click the Libraries item.
- Click Add Jar/Folder button.
- Find the LeapJava.jar file in your Leap Motion SDK.
- Click Ok to add the Jar file to your project.
- Next, click the Run item in the Project properties list
- Set the VM Options field to set the -Djava.library.path parameter to the path to the proper folder containing the Leap Motion native libraries.
On Windows, be sure to select the folder containing the correct libraries for your target architecture. If you are targeting a 32-bit JVM, use the Leap Motion libraries in the x86 folder of the SDK. If you are targeting a 64-bit JVM, use the libraries in the x64 folder. On Mac, each Leap Motion library file supports both architectures.