Difference between revisions of "Java"

From RobotinoWiki
(Building the Camera example)
m (Examples)
Line 12: Line 12:
  
 
= Examples =
 
= Examples =
A few examples (CS projects) have been provided and can be found under the examples/java folder.
+
A few examples have been provided and can be found under the examples/java folder.
  
 
== Building the examples ==
 
== Building the examples ==

Revision as of 09:04, 6 December 2011

Building the Openrobotino API2 Java Wrapper

Prerequisites

  1. Firstly, make sure you have the RobotinoAPI2 installed on your system. You also have the option of building it from the sources which can be done from here. If building from the sources, DO NOT forget to set the environment variables pointing to the RobotinoAPI2 install folder.
  2. Swigwin - Download the swigwin package from here and unzip it in the C:\Program Files or (C:\Program Files (x86) for 64Bit Windows) directory.

Building the wrapper

  1. Check out the package from here.
  2. Build and install the package using CMake. Note: the CMake looks for the Openrobotino API2 package using the environment variable. Make sure it is set.
  3. Once built and installed, set the evironment variable ROBOTINOAPI2WRAPPER32_DIR (if built using a 32Bit compiler ) pointing to the install folder. For example:
    ROBOTINOAPI2WRAPPER32_DIR=C:\Projects\_builds\build_openrobotino_api2_wrapper\install
    or if built using a 64Bit compiler then set an environment variable ROBOTINOAPI2WRAPPER64_DIR instead.
  4. Done!

Examples

A few examples have been provided and can be found under the examples/java folder.

Building the examples

Prerequisites

  1. Please install the latest Java Development Kit and install it.
  2. Also download the Eclipse IDE for Java Developers. You don't need to install this, just unzip the downloaded folder in your preferred directory.

Building the Camera example

  1. Run eclipse.exe
  2. Select your preferred workspace if you haven't done so already.
  3. Once eclipse has started, select File->New->Project from the Menu bar.
  4. Select "Java Project from Existing Ant Buildfile" by expanding the Java field.
  5. Navigate to the build.xml file in the Camera folder to locate the Ant Buildfile. Click finish.
  6. Once the project has been loaded, build and run it as a "Java Application". If the "Select Java Application" window opens then replace the ** by main and then select Main - (default package).
  7. The application should now run. Type the IP address of Robotino and click Connect.

Repeat the same procedure to build the other examples.