Setting up a JogAmp project in your favorite IDE and Maven: Difference between pages

From JogampWiki
(Difference between pages)
Jump to navigation Jump to search
(→‎Maven: Adds a link to the JogAmp development repository as it's necessary since JOGL 2.4.0)
 
No edit summary
 
Line 1: Line 1:
__TOC__
__TOC__


These instructions assume that you've created a project in your favorite IDE, and now you want your project to be able to use a JogAmp library like JOGL, JOCL, JOAL, or GlueGen. We use JOGL as an example below, but these instructions work equally well for any other JogAmp library.
JogAmp now contains support for Maven. From <tt>2.0-rc11</tt> to <tt>2.3.2</tt>, packages are pushed to  
[http://search.maven.org/#search|ga|1|jogamp Maven Central]. Since <tt>2.4.0</tt>, they are pushed only to [https://jogamp.org/deployment/maven/ the Jogamp Test Repository].


= Download a JogAmp library =
= Add dependencies on the correct packages =


If you haven't done so already, download and extract the JogAmp library you want to use. For example, to download and extract JOGL, see the instructions at [[Downloading and installing JOGL]].
If you don't know which packages you want, you almost certainly want to use the
<tt>jogl-all-main</tt> and <tt>gluegen-rt-main</tt> packages, as these automatically
set up the correct dependencies on the native jar files for all platforms.


To use a JogAmp library you'll do three things:
As an example, if your project uses JOGL <tt>2.3.1</tt>:


* Add its JAR files to the Java classpath
<pre>
* Add its native libraries in one of two ways:
  <dependencies>
** Either place its native JAR files in the same directory as the library JAR files
    <dependency>
** Or add its native library files(the <tt>.dll</tt>,<tt>.so</tt>, and <tt>.jnilib</tt> files) to the Java library path
      <groupId>org.jogamp.gluegen</groupId>
* Optional: Associate the *-java-src.zip files with the corresponding JAR files.
      <artifactId>gluegen-rt-main</artifactId>
      <version>2.3.1</version>
    </dependency>
    <dependency>
      <groupId>org.jogamp.jogl</groupId>
      <artifactId>jogl-all-main</artifactId>
      <version>2.3.1</version>
    </dependency>
  </dependencies>
</pre>


Each IDE has a slightly different way to do these things, as we show below. Using the native JAR files is usually slightly easier than using the native library files directly, and native JARs make it possible for all platforms' libraries to coexist in one project, so this is the recommended method.
Maven will pull all of the dependencies the next time you attempt to build the project.


Please note that all JogAmp libraries depend on the GlueGen runtime libraries. These are included in every JogAmp library for convenience, but are only required once in the classpath and library path of your project.
Additionally, for <tt>joal</tt> and <tt>jocl</tt> support:


See  [[JogAmp JAR File Handling|JogAmp JAR File Handling]], for details on native JAR files and custom JAR bundling.
<pre>
  <dependencies>
    <dependency>
      <groupId>org.jogamp.jocl</groupId>
      <artifactId>jocl-main</artifactId>
      <version>2.3.1</version>
    </dependency>
    <dependency>
      <groupId>org.jogamp.joal</groupId>
      <artifactId>joal-main</artifactId>
      <version>2.3.1</version>
    </dependency>
  </dependencies>
</pre>


= Eclipse IDE project =
An example project is available in the <tt>maven</tt> subdirectory of the <tt>jogl-demos</tt> project
[http://jogamp.org/git/?p=jogl-demos.git;a=tree;f=maven].


Probably the simplest way to use JOGL in an Eclipse project is to create another Eclipse project to contain the JOGL JARs, then make your project depend on this new JOGL project. In the example below, I include only the 64-bit Windows native JARs, but you can put native JARs for as many platforms as you wish together into the JOGL Eclipse project.
= Package details =


=== Create a JOGL project ===
For each JogAmp project, there are essentially two packages published: One contains the main compiled
jar files and any associated native library jar files, and the other simply contains <i>dependencies</i>
on those files. Using <tt>jogl-all</tt> and <tt>jogl-all-main</tt> as the example, the <tt>jogl-all</tt>
package in the jogamp.org test repository:


* Put all the JOGL code JARs, native JARs for all platforms you wish to support, and source ZIP files in a directory called "JOGL" in your workspace directory.
http://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.3.1/
* Click "File > New > Java Project". Type "JOGL" as the project name and click "Next".
[[File:Eclipse_project_setup_01_create_project.png|300px|thumb|none|Create JOGL project]]
* Remove the native JARs from the project, leaving only gluegen-rt.jar and jogl-all.jar.
[[File:Eclipse_project_setup_02_remove_native_JARs.png|300px|thumb|none|Remove native JARs]]
          NOTE: The gluegen-rt-natives-*-*.jar and jogl-all-natives-*-*.jar are not
          required in the classpath by JOGL, but are required by Eclipse to export
          your project as a runnable JAR file.
* Expand the jogl-all and gluegen-rt JARs. For each of them, double-click "Source attachment", click "Workspace...", navigate to the corresponding <tt>*-java-src.zip</tt> file in the project, select it, click "OK", and click "OK" again to dismiss the "Source Attachment Configuration" dialog. The JARs should look like this when you're done:
[[File:Eclipse_project_setup_03_JARs_with_source_attached.png|300px|thumb|none|Attach source to JARs]]
* Click the "Order and Export" tab. Check both JOGL JARs, then click "Finish".
[[File:Eclipse_project_setup_04_order_and_export.png|300px|thumb|none|Exporting JOGL JARs]]


=== Add dependency on the JOGL project ===
Note that there are many native jar files attached to the main package. However, if you were to use
the following dependency in your own project:


* Right-click your project and click "Properties".
<pre>
* Select the "Java Build Path" on the left, then click the "Projects" tab on the right.
  <dependency>
* Click the "Add..." button, check "JOGL", and click "OK".
    <groupId>org.jogamp.jogl</groupId>
* Your dependent project should look like this. Click "OK" to dismiss the "Properties" dialog.
    <artifactId>jogl-all</artifactId>
[[File:Eclipse_project_setup_05_project_dependency.png|300px|thumb|none|JOGL project dependency]]
    <version>2.3.1</version>
  </dependency>
</pre>


That's it! Your project can now use the library.
Maven would download <tt>jogl-all-2.3.1.jar</tt> but would completely ignore all of the other
native jar files. Why? The reason for this is that the native jar files are uploaded as extra artifacts
to the <tt>jogl-all</tt> package and are, in a manner of speaking, not really considered to be part of
the package where dependencies are concerned. The POM for the <tt>jogl-all-main</tt> package adds
explicit dependencies on all of the extra artifacts in the <tt>jogl-all</tt> package:


= Eclipse IDE user library =
http://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all-main/2.3.1/jogl-all-main-2.3.1.pom


If you don't want to put JOGL in a separate Eclipse project, you can put it in a user library instead. The drawback to this is that the user library is defined in your .metadata directory and contains absolute paths, so it's hard to share with others. But for a non-shared project this works fine.
So, when you add a dependency on <tt>jogl-all-main</tt> in your own project, the native jar files of
<tt>jogl-all</tt> are brought in as transitive dependencies and everything works as expected.


=== Create a user library ===
= Available packages =


* Click "Window > Preferences", then select "Java > Build Path > User Libraries" on the left.
{|
* Click the "New..." button, type "JOGL" for the library name, and click "OK".
|Group ID
[[File:Eclipse_setup_01_create_user_library.png|300px|thumb|none|Create user library]]
|Artifact ID
* Click the "Add JARs..." button, navigate to the directory where you've stored the JARs, select all the non-native JARs, then click "Open".
|Since
* If you're using native JAR files:
|Description
** Make sure the <tt>gluegen-rt-natives-*-*.jar</tt> and <tt>jogl-all-natives-*-*.jar</tt> files for each platform you want to run on are in the same directory as the other JAR files. The native JAR files don't need to be added to the classpath.
|-
* Expand each non-native JAR in the list
|org.jogamp.gluegen
** Double-click "Source attachment", type the module's source zip name, (e.g. <tt>jogl-java-src.zip</tt> for the JAR file <tt>jogl-all.jar</tt>), and click "OK".
|gluegen-rt-android
** If you're using native library files:
|2.0.2-rc12
*** Double-click "Native library location", type the directory where native library files are stored, and click "OK".
|GlueGen runtime code and native libraries (Android)
[[File:Eclipse_setup_02_set_native_library_locations.png|300px|thumb|none|Set native library locations]]
|-
* Click "OK" to exit Preferences dialog.
|org.jogamp.gluegen
|gluegen-rt-main
|2.0-rc11
|Meta-package for automatic dependency resolution for the GlueGen runtime
|-
|org.jogamp.gluegen
|gluegen-rt
|2.0-rc11
|GlueGen runtime code and native libraries
|-
|org.jogamp.gluegen
|gluegen
|2.0-rc11
|GlueGen non-runtime code and native libraries (and atomic jars)
|-
|org.jogamp.joal
|joal-main
|2.0-rc11
|Meta-package for automatic dependency resolution for JOAL
|-
|org.jogamp.joal
|joal
|2.0-rc11
|JOAL code and native libraries
|-
|org.jogamp.joal
|joal-android
|2.2.0
|JOAL Android runtime
|-
|org.jogamp.jocl
|jocl-main
|2.0-rc11
|Meta-package for automatic dependency resolution for JOCL
|-
|org.jogamp.jocl
|jocl-android
|2.2.0
|JOCL Android runtime
|-
|org.jogamp.jocl
|jocl
|2.0-rc11
|JOCL code and native libraries
|-
|org.jogamp.jogl
|jogl-all-main
|2.0-rc11
|Meta-package for automatic dependency resolution for JOGL
|-
|org.jogamp.jogl
|jogl-all
|2.0-rc11
|JOGL code and native libraries
|-
|org.jogamp.jogl
|jogl-android
|2.0.2-rc12
|JOGL code and native libraries (Android)
|-
|org.jogamp.jogl
|jogl-android-main
|2.2.0
|Meta-package for automatic dependency resolution for JOGL (Android)
|-
|org.jogamp.jogl
|jogl-mobile-main
|2.0-rc11
|Meta-package for automatic dependency resolution for JOGL (mobile)
|-
|org.jogamp.jogl
|jogl-mobile
|2.0-rc11
|JOGL mobile code and native libraries (without AWT)
|-
|org.jogamp.jogl
|jogl-noawt-main
|2.0-rc11
|Meta-package for automatic dependency resolution for JOGL (without AWT)
|-
|org.jogamp.jogl
|jogl-noawt
|2.0-rc11
|JOGL code and native libraries (without AWT)
|-
|org.jogamp.jogl
|jogl
|2.0.2
|JOGL atomic jar files
|-
|org.jogamp.jogl
|nativewindow
|2.0.2
|Native window drivers for NEWT (atomic jars)
|-
|org.jogamp.jogl
|nativewindow-main
|2.2.0
|Native window drivers for NEWT (atomic frontend)
|-
|org.jogamp.jogl
|newt
|2.0.2
|NEWT code and native libraries (atomic jars)
|-
|org.jogamp.jogl
|newt-main
|2.2.0
|NEWT code and native libraries (atomic frontend)
|-
|org.jogamp.jogl
|occulusvr
|2.2.0
|JOGL code and native libraries (Oculus VR atomic jar files)
|-
|}


=== Add the user library to your project's dependencies ===
= Atomic jar files (optional) =


* Right-click your project in the Package Explorer and click "Properties".
The so-called <i>atomic</i> jar files are provided as attachments to the <tt>jogl</tt>, <tt>newt</tt>,
* Select "Java Build Path" and click the "Libraries" tab.
<tt>nativewindow</tt> and <tt>gluegen</tt> packages. As an example, to depend only on the Linux AMD64
[[File:Eclipse_setup_03_add_library_to_project.png|300px|thumb|none|Add library to project]]
native jar files, on X11, using only the core of <tt>jogl</tt> and the native window toolkit in your
* Click "Add Library...", select "User Library", click "Next", check "JOGL", and click "Finish".
own projects, use the following dependencies:
[[File:Eclipse_setup_04_add_JOGL_library_to_project.png|300px|thumb|none|Add JOGL library to project]]
* Click "OK" to dismiss the Properties dialog.


That's it! You can now use the library in your project.
<pre>
  <dependency>
    <groupId>org.jogamp.gluegen-rt</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
  </dependency>
  <dependency>
    <groupId>org.jogamp.gluegen-rt</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>core</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>os-x11</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>os-x11</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>newt</artifactId>
    <version>2.3.1</version>
    <classifier>driver-x11</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>newt</artifactId>
    <version>2.3.1</version>
    <classifier>core</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>newt</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>nativewindow</artifactId>
    <version>2.3.1</version>
    <classifier>core</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>nativewindow</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>nativewindow</artifactId>
    <version>2.3.1</version>
    <classifier>driver-x11</classifier>
  </dependency>
</pre>


= IntelliJ IDEA =
Note that the choice of which atomic jars are required is really outside of the scope of this
=== Add a library dependency to your project ===
documentation. It's recommended that you browse the packages in question to see which jar
files are available. It's <i>not</i> recommended to depend on platform-specific jar files
in the manner shown above unless there's an extremely good reason to do so; to do otherwise
harms portability for no good reason!


* Click "File > Project Structure".
= The jogamp.org test repository (optional) =
* Select "Modules" on the left, then click the "Dependencies" tab on the right.
* Click the "+" button on the right, then select "Library... > Java".
[[File:IntelliJ_setup_01_add_library.png|300px|thumb|none|Add library]]
* Navigate to the directory where you extracted the JARs, select it, and click "OK".
[[File:IntelliJ_setup_02_find_library.png|300px|thumb|none|Find library]]
* Click "OK" to dismiss the Configure Library dialog.
[[File:IntelliJ_setup_03_configure_library.png|300px|thumb|none|Configure library]]
* Click "OK" to dismiss the Project Structure dialog. The external libraries in your project should now look like this if you're using native JAR files:
[[File:IntelliJ_setup_04_external_library_native_JARs.png|300px|thumb|none|Native JARs]]
or like this if you're using native library files:
[[File:IntelliJ_setup_04_external_library.png|300px|thumb|none|Native library files]]


* If you're using native JAR files:
Bleeding edge, experimental packages will continue to be made available from the
** Make sure the <tt>gluegen-rt-natives-*-*.jar</tt> and <tt>jogl-all-natives-*-*.jar</tt> files for each platform you want to run on are in the same directory as the other JAR files.
[https://jogamp.org/deployment/maven Jogamp Test Repository]. Most users won't need this, but
* Otherwise, if you're using native library files:
it can be used by adding a new profile in your <tt>~/.m2/settings.xml</tt> file that specifies
** Click "Run > Edit Configurations".
the repository:
** Type <tt>-Djava.library.path=your/path/to/native/library/files</tt> in the "VM Parameters" box. Note that paths with spaces must be double-quoted on Windows.
[[File:IntelliJ_setup_05_run_configuration.png|300px|thumb|none|Edit run configuration]]
** Click "OK" to dismiss the Run/Debug Configurations dialog.


That's it! You can now use the library in your project.
<pre>
  <?xml version="1.0" encoding="UTF-8"?>
  <settings
    xmlns="http://maven.apache.org/SETTINGS/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <profiles>
      <profile>
        <id>jogamp</id>
        <repositories>
          <repository>
            <id>jogamp-remote</id>
            <name>jogamp test mirror</name>
            <url>https://www.jogamp.org/deployment/maven/</url>
            <layout>default</layout>
          </repository>
        </repositories>
      </profile>
    </profiles>
    <activeProfiles>
      <activeProfile>jogamp</activeProfile>
    </activeProfiles>
  </settings>
</pre>


= NetBeans IDE =
Maven will then check this repository for packages in addition to Maven Central when resolving dependencies.
=== Create a library and add it to your project ===


* Right-click your project and click "Properties".
'''''Please note that packages on the jogamp test repository are subject to unannounced changes at any moment and may break existing code at any time! Do not use for production code!'''''
* Select "Libraries" on the left and click "Add Library...".
* Click the "Create" button, then type "JOGL" for the library name and click "OK".[[File:NetBeans_setup_01_create_library.png|300px|thumb|none|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.[[File:NetBeans_setup_02_add_library.png|300px|thumb|none|Add library]]
* Click "OK" to dismiss the Project Properties dialog. The libraries in your project should look like this.[[File:NetBeans_setup_03_libraries_in_project.png|300px|thumb|none|Libraries in project]]


* If you're using native JAR files:
= Android =
** Make sure the <tt>gluegen-rt-natives-*-*.jar</tt> and <tt>jogl-all-natives-*-*.jar</tt> files for each platform you want to run on are in the same directory as the other JAR files. The native JAR files don't need to be added to the classpath.
* Otherwise, if you're using native library files:
** Click "Run > Set Project Configuration > Customize...". Select "Run" on the left if it isn't selected already.
** Type <tt>-Djava.library.path=your/path/to/native/library/files</tt> in the "VM Options" box.
** NOTE: If the library path has spaces in it, you must put quotes around it (at least on Windows) or you may get an odd NoClassDefFoundError when you try to run.[[File:NetBeans_setup_04_native_library_path.png|300px|thumb|none|Native library path]]
** Click "OK" to dismiss the Project Properties dialog.


That's it! You can now use the library in your project.
There is a [[Maven_And_Android|separate page]] documenting one method of producing packages that work on both Android and ordinary
desktop Java.


= Maven =
= Producing a fat jar =


From <tt>2.0-rc11</tt> to <tt>2.3.2</tt>, packages for all the JogAmp projects have been pushed to
See [[JogAmp_JAR_File_Handling#Maven_Assembly_Plugin|JAR File Handling]].
[http://search.maven.org/#search|ga|1|jogamp Maven Central]. Since <tt>2.4.0</tt>, they have been pushed only to [https://jogamp.org/deployment/maven/ the JogAmp development repository]. Please see the
[[Maven]] page for details on how to use them in your projects.
 
= vi and other text editors =
=== Create your project with the editor of your choice ===
* For example, to open vi, simply type <tt>vi</tt> and press <return>.
* Type all your code, then save it.
 
=== Compile and run your project from the command line ===
* We assume your JOGL JAR files are in a directory called <tt>jar</tt>. If you're using native JARs, we assume they're also in the <tt>jar</tt> directory. If you're using native library files, we assume they're in a directory called <tt>lib</tt>.
 
* First compile your program. We assume all your code is in a single file called <tt>name/someone/MyProject.java</tt>.
** Windows: Type <tt>javac -classpath "jar\gluegen-rt.jar;jar\jogl-all.jar" name\someone\MyProject.java</tt>
** Linux/MacOS X: Type <tt>javac -classpath "jar/gluegen-rt.jar:jar/jogl-all.jar" name/someone/MyProject.java</tt>
 
* Then run your project. We assume your main class is <tt>name.someone.MyProject</tt>. If you're using native JARs:
** Windows: Type <tt>java -classpath "jar\gluegen-rt.jar;jar\jogl-all.jar;." name.someone.MyProject</tt>
** Linux/MacOS X: Type <tt>java -classpath "jar/gluegen-rt.jar:jar/jogl-all.jar:." name.someone.MyProject</tt>
* If you're using native library files:
** Windows: Type <tt>java -classpath "jar\gluegen-rt.jar;jar\jogl-all.jar;." -Djava.library.path=lib -Djogamp.gluegen.UseTempJarCache=false name.someone.MyProject</tt>
** Linux/MacOS X: Type <tt>java -classpath "jar/gluegen-rt.jar:jar/jogl-all.jar:." -Djava.library.path=lib -Djogamp.gluegen.UseTempJarCache=false name.someone.MyProject</tt>
 
That's it! You can now use the library in your project.

Revision as of 11:45, 21 May 2023

JogAmp now contains support for Maven. From 2.0-rc11 to 2.3.2, packages are pushed to Maven Central. Since 2.4.0, they are pushed only to the Jogamp Test Repository.

Add dependencies on the correct packages

If you don't know which packages you want, you almost certainly want to use the jogl-all-main and gluegen-rt-main packages, as these automatically set up the correct dependencies on the native jar files for all platforms.

As an example, if your project uses JOGL 2.3.1:

  <dependencies>
    <dependency>
      <groupId>org.jogamp.gluegen</groupId>
      <artifactId>gluegen-rt-main</artifactId>
      <version>2.3.1</version>
    </dependency>
    <dependency>
      <groupId>org.jogamp.jogl</groupId>
      <artifactId>jogl-all-main</artifactId>
      <version>2.3.1</version>
    </dependency>
  </dependencies>

Maven will pull all of the dependencies the next time you attempt to build the project.

Additionally, for joal and jocl support:

  <dependencies>
    <dependency>
      <groupId>org.jogamp.jocl</groupId>
      <artifactId>jocl-main</artifactId>
      <version>2.3.1</version>
    </dependency>
    <dependency>
      <groupId>org.jogamp.joal</groupId>
      <artifactId>joal-main</artifactId>
      <version>2.3.1</version>
    </dependency>
  </dependencies>

An example project is available in the maven subdirectory of the jogl-demos project [1].

Package details

For each JogAmp project, there are essentially two packages published: One contains the main compiled jar files and any associated native library jar files, and the other simply contains dependencies on those files. Using jogl-all and jogl-all-main as the example, the jogl-all package in the jogamp.org test repository:

http://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.3.1/

Note that there are many native jar files attached to the main package. However, if you were to use the following dependency in your own project:

  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl-all</artifactId>
    <version>2.3.1</version>
  </dependency>

Maven would download jogl-all-2.3.1.jar but would completely ignore all of the other native jar files. Why? The reason for this is that the native jar files are uploaded as extra artifacts to the jogl-all package and are, in a manner of speaking, not really considered to be part of the package where dependencies are concerned. The POM for the jogl-all-main package adds explicit dependencies on all of the extra artifacts in the jogl-all package:

http://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all-main/2.3.1/jogl-all-main-2.3.1.pom

So, when you add a dependency on jogl-all-main in your own project, the native jar files of jogl-all are brought in as transitive dependencies and everything works as expected.

Available packages

Group ID Artifact ID Since Description
org.jogamp.gluegen gluegen-rt-android 2.0.2-rc12 GlueGen runtime code and native libraries (Android)
org.jogamp.gluegen gluegen-rt-main 2.0-rc11 Meta-package for automatic dependency resolution for the GlueGen runtime
org.jogamp.gluegen gluegen-rt 2.0-rc11 GlueGen runtime code and native libraries
org.jogamp.gluegen gluegen 2.0-rc11 GlueGen non-runtime code and native libraries (and atomic jars)
org.jogamp.joal joal-main 2.0-rc11 Meta-package for automatic dependency resolution for JOAL
org.jogamp.joal joal 2.0-rc11 JOAL code and native libraries
org.jogamp.joal joal-android 2.2.0 JOAL Android runtime
org.jogamp.jocl jocl-main 2.0-rc11 Meta-package for automatic dependency resolution for JOCL
org.jogamp.jocl jocl-android 2.2.0 JOCL Android runtime
org.jogamp.jocl jocl 2.0-rc11 JOCL code and native libraries
org.jogamp.jogl jogl-all-main 2.0-rc11 Meta-package for automatic dependency resolution for JOGL
org.jogamp.jogl jogl-all 2.0-rc11 JOGL code and native libraries
org.jogamp.jogl jogl-android 2.0.2-rc12 JOGL code and native libraries (Android)
org.jogamp.jogl jogl-android-main 2.2.0 Meta-package for automatic dependency resolution for JOGL (Android)
org.jogamp.jogl jogl-mobile-main 2.0-rc11 Meta-package for automatic dependency resolution for JOGL (mobile)
org.jogamp.jogl jogl-mobile 2.0-rc11 JOGL mobile code and native libraries (without AWT)
org.jogamp.jogl jogl-noawt-main 2.0-rc11 Meta-package for automatic dependency resolution for JOGL (without AWT)
org.jogamp.jogl jogl-noawt 2.0-rc11 JOGL code and native libraries (without AWT)
org.jogamp.jogl jogl 2.0.2 JOGL atomic jar files
org.jogamp.jogl nativewindow 2.0.2 Native window drivers for NEWT (atomic jars)
org.jogamp.jogl nativewindow-main 2.2.0 Native window drivers for NEWT (atomic frontend)
org.jogamp.jogl newt 2.0.2 NEWT code and native libraries (atomic jars)
org.jogamp.jogl newt-main 2.2.0 NEWT code and native libraries (atomic frontend)
org.jogamp.jogl occulusvr 2.2.0 JOGL code and native libraries (Oculus VR atomic jar files)

Atomic jar files (optional)

The so-called atomic jar files are provided as attachments to the jogl, newt, nativewindow and gluegen packages. As an example, to depend only on the Linux AMD64 native jar files, on X11, using only the core of jogl and the native window toolkit in your own projects, use the following dependencies:

  <dependency>
    <groupId>org.jogamp.gluegen-rt</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
  </dependency>
  <dependency>
    <groupId>org.jogamp.gluegen-rt</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>core</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>os-x11</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl</artifactId>
    <version>2.3.1</version>
    <classifier>os-x11</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>newt</artifactId>
    <version>2.3.1</version>
    <classifier>driver-x11</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>newt</artifactId>
    <version>2.3.1</version>
    <classifier>core</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>newt</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>nativewindow</artifactId>
    <version>2.3.1</version>
    <classifier>core</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>nativewindow</artifactId>
    <version>2.3.1</version>
    <classifier>natives-linux-amd64</classifier>
  </dependency>
  <dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>nativewindow</artifactId>
    <version>2.3.1</version>
    <classifier>driver-x11</classifier>
  </dependency>

Note that the choice of which atomic jars are required is really outside of the scope of this documentation. It's recommended that you browse the packages in question to see which jar files are available. It's not recommended to depend on platform-specific jar files in the manner shown above unless there's an extremely good reason to do so; to do otherwise harms portability for no good reason!

The jogamp.org test repository (optional)

Bleeding edge, experimental packages will continue to be made available from the Jogamp Test Repository. Most users won't need this, but it can be used by adding a new profile in your ~/.m2/settings.xml file that specifies the repository:

  <?xml version="1.0" encoding="UTF-8"?>
  <settings
    xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <profiles>
      <profile>
        <id>jogamp</id>
        <repositories>
          <repository>
            <id>jogamp-remote</id>
            <name>jogamp test mirror</name>
            <url>https://www.jogamp.org/deployment/maven/</url>
            <layout>default</layout>
          </repository>
        </repositories>
      </profile>
    </profiles>
    <activeProfiles>
      <activeProfile>jogamp</activeProfile>
    </activeProfiles>
  </settings>

Maven will then check this repository for packages in addition to Maven Central when resolving dependencies.

Please note that packages on the jogamp test repository are subject to unannounced changes at any moment and may break existing code at any time! Do not use for production code!

Android

There is a separate page documenting one method of producing packages that work on both Android and ordinary desktop Java.

Producing a fat jar

See JAR File Handling.