User Tools

Site Tools


tutorials:legacy:java_processing:getting_started_1_hello_world

This binding has been deprecated - please see the most recent release notes for more information.

Getting Started I (Hello World)

Introduction

In this tutorial you will prepare your development environment for use with the Java bindings for Gestureworks Core. While no code will be written in this tutorial, the steps performed here will prepare your environment for subsequent Gestureworks Core Java tutorials. For this tutorial you will need the Gestureworks Core multitouch framework; a free trial is available.

Download the code for all of the Java & Processing multitouch tutorials here: tutorials_java_processing.zip

Gestureworks Core "Bindings"

The various bindings included with Gestureworks Core allow a developer to create multitouch applications using their preferred language and framework, and are essentially mini-APIs providing an interface to the functions exported by the native GestureWorksCore library (GestureworksCore32.dll, GestureworksCore64.dll). Source code for each of the bindings is included so that you may extend or modify them as you like, as well as providing a blueprint for creating bindings for other languages or frameworks.

NetBeans and Processing

The Java bindings for Gestureworks Core can be used by any Java project. The source code for the Java bindings is provided for portability and extensibility, but can be used quite effectively as-is in most situations.

In this and the following tutorials, NetBeans IDE 7 is used for demonstrating Gestureworks Core fundamentals using the Java bindings. Processing is an open source programming language built for the electronic arts and visual design communities with the purpose of teaching the fundamentals of computer programming in a visual context, and to serve as the foundation for electronic sketchbooks.


Requirements

  • Gestureworks Core license
  • Microsoft Windows 7 or 8
  • NetBeans IDE
  • JDK for Windows
  • Multitouch display device

Process Overview

Process Detail

1. Download and install software prerequisites

Each of the following software packages must be downloaded and installed prior to continuing with the tutorial.

2. Download and install Gestureworks Core package

The Gestureworks Core installer package – GestureWorksCoreSetup.exe – contains the main GestureWorksCore.dll files (the “native” DLLs), various bindings (C++ .NET, Python, etc.), and supporting documentation. GestureWorksCore must be licensed prior to use in any software project.

  1. Download the Gestureworks Core Trial package from here.
  2. Double-click the downloaded installer package GestureWorksCoreSetup.exe to install Gestureworks Core.

Gestureworks Core consists of the GestureWorksCore DLLs as well as various tutorials and bindings:

GestureWorksCore*.dlls
\GestureWorksCore\GestureWorksCore32.dll
\GestureWorksCore\GestureWorksCore64.dll

Java bindings
\GestureWorksCore\bindings\java\gwc_java

Processing tutorials
\GestureWorksCore\bindings\java\Processing\tutorials

Assets for the tutorials
\GestureWorksCore\bindings\java\resources

3. Create a new Java project in NetBeans

First, create a new Java project

  1. Click File > New Project
  2. Under Categories, click Java
  3. Under Projects click Java Application
  4. Click the Next button Java 1.1.png
  5. name the project “GestureWorksTutorial1”
  6. (optional) Click Browse… to select a location for the project folder
  7. Select the Create Main Class check box
  8. Rename the main class to TouchSketch by editing the text appending gestureworkstutorial1.
  9. Click Finish

Java processing 1.2.png

4. Add project dependencies

Next we need to add the following dependencies to the project. After a few edits, you’ll be able to start using the Java bindings to work with Gestureworks Core.

  • gwc_java project jar (Java “bindings”)
  • Java Native Access jar (library the bindings use to link to the Gestureworks Core)
  • Processing jar (Processing core library)
  • file resources (GML file and image for proceeding tutorials)

Open the gwc_java project and select the “Clean and Build” option to build the jar file in the project's “dist” directory (https://netbeans.org/kb/docs/java/quickstart.html#build). Right-click on the project in the Projects Explorer, then click Properties > Libraries > Add Project…

Java 1.3.png

Browse to the folder containing the downloaded Gestureworks Core files, navigate to the gwc_java bindings folder, click on the file and click Add Project JAR Files.

Java 1.4.png

  1. Add the jna.jar by selecting the Add JAR/Folder in the ProjectProperties window, navigate to the same gwc_java bindings folder, select jna-3.5.1 and click Open.
  2. Now add the processing jar by selecting the Add JAR/Folder in the ProjectProperties window, navigate to the same \GestureWorks\bindings\java\Processing folder, select processing_core and click Open.
  3. The last dependency we need to add is the resource files. Navigate to and copy the folder located at \GestureWorks\bindings\java\resources. Click the Files tab in NetBeans to switch to the Files view, right click on the root project folder, and click Paste.

The project and file tree structures should appear as follows, indicating the successful addition of the project libraries and resource folder. This will allow using the gwc_java binding’s code and local resources in the following tutorials.

Java processing 1.5.png

Java 1.6.png

5. Platform management

If the project’s platform is not targeting a compatible JDK, the platform settings will need to be configured. A 32 bit DLL requires a 32 bit JDK and a 64 bit DLL requires a 64 bit JDK.

  1. Win 7 vs. Win 8, 32- vs. 64-bit
    • Please ensure that you are using the correct version and platform of the GestureWorksCore DLLs for your project. There are Windows 7 and Windows 8 versions of the GestureWorksCore DLLs, as well as x86 and x64 versions of each. Be sure to use the matching DLLs for your OS and platform when you are compiling your project. Targeting the GestureWorks*.dll is covered further in Java & Processing: Getting Started II (Hello Multitouch).
  2. Target JDK
    • Right-click on the project in the Projects Explorer, then click Properties → Libraries → Manage Platforms
    • In the Java Platform Manager window, select Add Platform…
    • Navigate to and select the desired JDK and click Next
    • Assign a unique platform name to the JDK and click Finish
    • Update the project’s platform by clicking the Java Platform: drop down menu and selecting the name of the recently added JDK

Java 1.7.png


Review

In this tutorial we installed GestureWorks Core, the prerequisites for developing with the GestureWorks Core Java bindings, and created a project that includes the Java bindings project. From here we move on to Java & Processing: Getting Started II (Hello Multitouch) in which we dig into actual source code, initializing GestureWorks Core and working with touch and gesture event data.


Next tutorial: Java & Processing: Getting Started II (Hello Multitouch)

tutorials/legacy/java_processing/getting_started_1_hello_world.txt · Last modified: 2019/01/21 19:24 (external edit)