Setting up a JogAmp project in your favorite IDE

From JogampWiki
Revision as of 16:55, 5 March 2011 by Wwalker (talk | contribs) (Added Eclipse screenshots)
Jump to navigation Jump to search

It's very simple to set up a project of your favorite IDE to use a JogAmp library. These instructions assume you've already created a new project in the IDE.

Download a JogAmp project

If you haven't done so already, download and extract for example JOGL as described at Downloading_and_installing_JOGL.

To be able to use a JogAmp library you will have to add the jar files to the classpath and the native files to the library path of your projects run configuration. Please note that all projects depend on the GlueGen runtime libraries which are for convenience reasons included in every JogAmp project but only required once in the classpath/library path of your application.

Eclipse IDE

Create a user library

You can make your new Eclipse project depend directly on all the JARs and native libraries, but it's inconvenient to do that every time you create a new project. Creating a user library bundles all the files together so you can include them in one step.

  • Click "Window > Preferences", then select "Java > Build Path > User Libraries" on the left.
  • Click the "New..." button, type "JOAL", "JOCL", "JOGL" or "GlueGen RT" for the library name, and click "OK".
Create user library
  • Click the "Add JARs..." button, navigate to the directory where you've stored the JARs, select them, then click "Open".
  • Expand the jar in the list, double-click "Native library location", type the directory where native library files are stored, and click "OK".
Set native library locations
  • Click "OK" to exit Preferences dialog.

Add JOGL to your project's dependencies

  • Right-click your project in the Package Explorer and clock "Properties".
  • Select "Java Build Path" and click the "Libraries" tab.
Add library to project
  • Click "Add Library...", select "User Library", click "Next", check "JOGL", and click "Finish".
Add JOGL library to project
  • Click "OK" to dismiss the Properties dialog.

That's it! You can now use the library in your project.

IntelliJ IDEA

Add JOGL dependency to project

  • Click "File > Project Structure".
  • Select "Modules" on the left, then click the "Dependencies" tab on the right.
  • Click the "Add..." button, then click "Library...".
    Add library
  • Type "JOAL", "JOCL", "JOGL" or "GlueGen RT" as the library name.
  • Click "Attach JAR Directories...", navigate to the directory where you extracted the JARs and click "OK".
  • Click "OK" to dismiss the Configure Library dialog.
    Configure library
  • Click "OK" to dismiss the Project Structure dialog. The external libraries in your project should now look like this.
    External libraries
  • Click "Run > Edit Configurations".
  • Type -Djava.library.path=your/path/to/native/library/files in the "VM Parameters" box.
    Edit run configuration
  • Click "OK" to dismiss the Run/Debug Configurations dialog.

That's it! You can now use the library in your project.

NetBeans IDE

Create a JOGL library dependency

  • Right-click your project and click "Properties".
  • Select "Libraries" on the left and click "Add Library...".
  • Click the "Create" button, then type "JOAL", "JOCL", "JOGL" or "GlueGen RT" for the library name and click "OK".
    Create library
  • Click "Add JAR/Folder...", then navigate to the directory you extracted the JAR files, select them and click "Add JAR/Folder".
  • Click "OK" to dismiss the Customize Library dialog.
  • Click "Add Library" to dismiss the Add Library dialog.
    Add library
  • Click "OK" to dismiss the Project Properties dialog. The libraries in your project should look like this.
    Libraries in project
  • Click "Run > Set Project Configuration > Customize...". Select "Run" on the left if it isn't selected already.
  • Type -Djava.library.path=your/path/to/native/library/files in the "VM Options" box.
    Native library path
  • Click "OK" to dismiss the Project Properties dialog.

That's it! You can now use the library in your project.

Vi

Open a shell of your choice

$vi <return>

That's it!