My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
IDESetup  
this page explains how to import v4l4j in Eclipse and NetBeans
Featured
Updated Mar 22, 2011 by gilles.g...@gmail.com

This page explains how to import v4l4j in Eclipse and Netbeans.

Using v4l4j in your own project

Follow these steps if you want to use v4l4j in your own application. First, you must install v4l4j by following the installation instructions on the GettingStarted page. Then follow the instructions for your IDE below.

Eclipse project

Assuming you have already created your Eclipse project, do the following to import the v4l4j JAR file, JNI library and JavaDoc:

  • In the Project Explorer pane, right-click on your project and select Build Path -> Configure build path.
  • Select the Libraries tab, and click Add external JARs...
  • Select /usr/share/java/v4l4j.jar
  • Expand the v4l4j.jar entry and double click on Native library location
  • Select /usr/lib/jni
  • Double click on Javadoc location, and select Javadoc URL
  • Enter http://v4l4j.googlecode.com/svn/www/v4l4j-api
  • Select OK

Your project is now setup to use v4l4j.

NetBeans project

Create a new library entry for v4l4j: (The following steps should be done only once)

  • Go to Tools -> Libraries
  • Select New Library
  • Use v4l4j as the name and Class Library as the type
  • Under the Classpath tab, click Add Jar... and add /usr/share/java/v4l4j.jar
  • If you have installed the JavaDoc, select the JavaDoc tab, click Add ZIP/Folder, add /usr/share/doc/libv4l4j-doc/api and click OK
  • Select OK

Include v4l4j in your project:

  • Right-click on your project and select Properties
  • In the Libraries category, under the Compile tab, click Add Library...
  • Select v4l4j from the list and click Add Library
  • In the Run category, add -Djava.library.path=/usr/lib/jni in the VM Options textbox
  • Click OK

Creating an Eclipse project to work on v4l4j

Follow these steps if you are planning to work on v4l4j itself. There are two ways to create a project for v4l4j in Eclipse:

  • by checking out a copy of v4l4j from the subversion repository and creating a new project, or
  • by downloading the source tarball, unpacking it and importing it in Eclipse.
Both of these are explained in the following sections. I have tested them with Eclipse Ganymede version 3.4.1

Importing from SVN

  1. First, make sure you have a working Subversion plug-in for Eclipse. You can use either subclipse, or Subversive. These steps assume you use Subclipse, but can be used with Subversive too.
  2. In eclipse, check out a copy of http://v4l4j.googlecode.com/svn/v4l4j/trunk using the New project wizard. Refer to your eclipse plugin documentation to find out how to do that.
  3. Select the Java Project wizard.
  4. Give the project a name (we will use v4l4j-trunk). Make sure you use JRE 6. Select "create separate folders for sources and class files".
  5. On the Java settings page, change the default output folder to v4l4j-trunk/classes, and click "finish".
  6. When the checkout is completed, right-click on the project in the package explorer view, and select "New" -> "Other...".
  7. On the "Select a wizard" page, select "Convert to a C/C++ Make project" and click Next.
  8. Select only the v4l4j-trunk project and "C project", and click Finish.
  9. Right-click on the project in the package explorer view and select "Build path" -> "Configure build path".
  10. Expand the "C/C++ General" node on the left side and select "Paths & symbols".
  11. In the "Includes" tab, select "GNU C" in "Languages". Click on "Add..." and select "File system...". Navigate to the location of your JDK, and select the "include" directory. On my computer (Ubuntu Hardy 8.04), the Sun JDK 6 is installed at "/usr/lib/jvm/java-6-sun", so I selected "/usr/lib/jvm/java-6-sun/include". Repeat the process and add "/usr/lib/jvm/java-6-sun/include/linux".
  12. Click on "Add..." one last time, select "Workspace..." and select the libvideo directory under the v4l4j-trunk project.
  13. You may need to add Junit to the build path. Right on the v4l4j-trunk project in the package explorer, select "Build path" -> "Configure build path".
  14. On the Libraries tab, select "Add JAR...", navigate to the lib directory in the v4l4j-trunk project and select the junit jar file. Click OK

You can now create your own project that uses v4l4j. Eclipse's auto-complete feature will now offer v4l4j-related classes, and will show v4l4j's javadoc.

Importing from source tarball

The steps here are very similar to the previous ones:

  1. Download the latest stable version of v4l4j using the link on the homepage. At the time of writing, the latest stable version is 0.8 and the source archive is at http://v4l4j.googlecode.com/files/v4l4j-0.8.0.tar.gz .
  2. Unpack the archive in your eclipse workspace dirctory.
  3. In Eclipse, select "File" -> "New" -> "Java project".
  4. Select "Create project from existing source" and continue from step 4 above.
Powered by Google Project Hosting