diff --git a/examples/nbody/.classpath b/examples/nbody/.classpath
index a9d6505892faf0e88efd0a9b2deee32074f4268d..b7fff1d8aee547de9ae86e84371e77303f408adc 100644
--- a/examples/nbody/.classpath
+++ b/examples/nbody/.classpath
@@ -1,18 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="lib" path="/com.amd.aparapi/dist/aparapi.jar" sourcepath="/com.amd.aparapi">
- <attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="com.amd.aparapi.jni/dist"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="lib" path="/third-party/jogamp/gluegen-rt.jar">
- <attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="third-party/jogamp"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="lib" path="/third-party/jogamp/jogl-all.jar"/>
- <classpathentry kind="output" path="classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="lib" path="/com.amd.aparapi/dist/aparapi.jar" sourcepath="/com.amd.aparapi">
+ <attributes>
+ <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="com.amd.aparapi.jni/dist"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib" path=".libs/gluegen-rt.jar"/>
+ <classpathentry kind="lib" path=".libs/jogl-all.jar"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
diff --git a/examples/nbody/.gitignore b/examples/nbody/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..995897440568f8eb3da5dc0424ec57a0aab1f8da
--- /dev/null
+++ b/examples/nbody/.gitignore
@@ -0,0 +1,2 @@
+/.libs/
+/classes/
diff --git a/examples/nbody/build.xml b/examples/nbody/build.xml
index c98e61af092c92cd9483a339625cb514656354d7..156e850e1a0331ae0e6e6d9771eb6c5201a0e947 100644
--- a/examples/nbody/build.xml
+++ b/examples/nbody/build.xml
@@ -2,13 +2,33 @@
<project name="nbody" default="build" basedir=".">
- <!--<property name="jogamp-jar-url" value="http://jogamp.org/deployment/archive/rc/gluegen_28-joal_17-jogl_41-jocl_25/jar"/>-->
- <property name="jogamp-jar-url" value="http://jogamp.org/deployment/archive/rc/gluegen_52-joal_32-jogl_66-jocl_41/jar" />
+ <!-- Ideally this would be the latest version of Java but not everyone is going to have it installed -->
+ <!-- Additionally we want to avoid "Class not found: javac1.8" errors from old Ant versions (i.e. Eclipse) -->
+ <property name="build.compiler" value="javac1.7" />
+ <property name="ant.build.javac.source" value="1.7" />
+ <property name="ant.build.javac.target" value="1.7" />
+ <property name="libs.root" value="${basedir}/.libs" />
+
+ <property name="jogl.all.jar" value="jogl-all.jar" />
+ <property name="jogl.all.natives.macosx.jar" value="jogl-all-natives-macosx-universal.jar" />
+ <property name="gluegen.rt.jar" value="gluegen-rt.jar" />
+ <property name="gluegen.rt.natives.macosx.jar" value="gluegen-rt-natives-macosx-universal.jar" />
+
+ <property name="jogamp.url" value="http://jogamp.org/deployment/archive/rc/gluegen_52-joal_32-jogl_66-jocl_41/jar" />
+
+ <property name="jogl.all.url" value="${jogamp.url}/${jogl.all.jar}" />
+ <property name="jogl.all.natives.macosx.url" value="${jogamp.url}/${jogl.all.natives.macosx.jar}" />
+ <property name="gluegen.rt.url" value="${jogamp.url}/${gluegen.rt.jar}" />
+ <property name="gluegen.rt.natives.macosx.url" value="${jogamp.url}/${gluegen.rt.natives.macosx.jar}" />
+
<path id="compiler.class.path">
<pathelement path="../../com.amd.aparapi/dist/aparapi.jar" />
- <pathelement path="../third-party/jogamp/jogl-all.jar" />
- <pathelement path="../third-party/jogamp/gluegen-rt.jar" />
+ <pathelement path="${libs.root}/${jogl.all.jar}" />
+ <pathelement path="${libs.root}/${jogl.all.natives.macosx.jar}" />
+ <pathelement path="${libs.root}/${gluegen.rt.jar}" />
+ <pathelement path="${libs.root}/${gluegen.rt.natives.macosx.jar}" />
+ <pathelement path="classes" />
</path>
<path id="runtime.class.path" cache="true">
@@ -16,6 +36,19 @@
<pathelement path="${ant.project.name}.jar" />
</path>
+ <target name="install.deps">
+ <mkdir dir="${libs.root}" />
+ <!-- Cleanup all existing deps -->
+ <delete failonerror="false" includeEmptyDirs="true">
+ <fileset dir="${libs.root}" includes="*/" />
+ </delete>
+ <!-- Download and unzip requested deps -->
+ <get src="${jogl.all.url}" dest="${libs.root}/${jogl.all.jar}" />
+ <get src="${jogl.all.natives.macosx.url}" dest="${libs.root}/${jogl.all.natives.macosx.jar}" />
+ <get src="${gluegen.rt.url}" dest="${libs.root}/${gluegen.rt.jar}" />
+ <get src="${gluegen.rt.natives.macosx.url}" dest="${libs.root}/${gluegen.rt.natives.macosx.jar}" />
+ </target>
+
<target name="build" depends="clean">
<mkdir dir="classes" />
<javac srcdir="src" destdir="classes" debug="on" includeantruntime="false">
@@ -54,5 +87,4 @@
<target name="run" depends="run-gpu" />
-
</project>