Page history | Log in / create account
Search:

Eclipse set-up tutorial

These three steps will get JReality running:

  • Complete prerequisites: JDK, Eclipse, and Git must be set up,
  • Then you can clon JReality from Git and
  • Test the setup by running some introductory tutorials

They are described in greater detail below.

Contents

Prerequisites: JDK, Eclipse, and SVN:

1. Download and install the most recent JDK (Java Development Kit)

Oracle Java download site.

You need Java SE Development Kit 6 or higher.

If you don't know Java yet, follow the tutorial:

  java-unix-tutorial
  java-win32-tutorial


2. Install Eclipse IDE for Java Developers

from eclipse download site

Image:ts-jr-eclipse-01.png

(or alternatively use Eclipse IDE for Java Developers or add Java to another package). When you first run Eclipse, check the box that says "Always use this workspace" and continue until you see the main window with the menubar.

Image:ts-jr-eclipse-02-welcome.png

Click the X next to "Welcome" now and if you ever see it again.

3. Install Git

by following this how to until step 5.1:

Install Git in Eclipse

Check out JReality source code with Git

For cloning the master branch of JReality, please follow this tutorial:

Checking out the current jReality source

Testing (jogl)

Now we can start a tutorial example:


Open "jreality"->"src-tutorial"->"de.jreality.tutorial.intro" and double-click on Icosahedron.java. The file opens in the java editor.


(Later on, try intro01.java, intro02.java, and browse for other examples provided in the project) Image:Ts-jr-eclipse-08-edit.png


Now go to the menu: Run->Run As...->Java Application or click the run icon:

Image:Ts-jr-eclipse-09-run.png

You should see an app frame like this:


Image:tutorial-viewerApp-nojogl.jpg


If you have two viewer entries at the top of the View menu, jogl is already running. You possibly have a linux64 system, which we have chosen as default. If the View menu looks as in the image above, you have to select the correct jni folder for your OS: Go to menu: "Project"->"Properties". Select Java Build Path on the left side. Open the source tab, and expand jreality/src-core and double-click on Native library location: jreality/jni/linux64:


Image:Screenshot-Properties-for-jreality.png


In the following dialog, select Workspace, and choose the folder that matches your OS:


Image:Screenshot-Native-Library-Location-WS.png


If you do not find the right folder go to the jogl homepage and look directly for your architecture. Extract the zip file (we are using the latest stable release 1.1.1) and put the native libs into a folder unter jreality/jni and select it then as Native Library Location. Note that you need to tell eclipse to refresh, after adding files to a project. (Menu: Project->Refresh).

Now run ViewerApp again, the View menu should now look like this:


Image:empty-ViewerApp-with-jogl.png

Adding VR data to the project

ViewerVR is a viewer that has already a floor, a skybox, a navigation tool for walking and jumping etc, and it also offers some demo geometries to explore. See the ViewerVR User Manual.


It is used in the application IcosahedronVR.java, which is right below Icosahedron.java. When you run it (Run->Run As...->Java Application) it will look like this:


Image:ViewerVR-no-data.png


We have to add the two jars vrData.jar and vrExamples.jar to the classpath. Go to the download page and save the two jars under jreality/lib/.

In Eclipse, right-click on the jreality/lib folder and say Refresh... Then expand the folder, select the two jars and add them to the build path: Right-click on the selection: Build Path->Add to Build Path.


Now run ViewerVR again, you should see the following:


Image:ViewerVR-with-data.jpg


Create own projects for programming with jReality

We suggest that you do not add your own code into the jReality project. Then you can always update to the newest jReality version, without having conflicts.

Instead, we create a new project and reference the jReality project therein:


In the Java Perspective, choose Menu: File->New...->Java Project, choose a project name and click "Finish".


Open the project Properties (just as for the jReality project): Menu: Project->Properties

Select "Java Build Path" on the left, and choose the "Projects"-Tab.

Click on "Add..." and select jReality. Then confirm by clicking "OK" and close the dialogue.


As a test, copy&paste a tutorial file, say de.jreality.tutorial.geom.Cube04.java into the new project and try to run it there. Note that you have to paste it into a source folder.

Tipps and Tricks

Add more memory when running an application

If a program is too slow or often interrupts for garbage collection, increase the heap size in the run configuration: Run->Run Configurations, as in the figure below.


Image:RunConfiguration-increase-heap.png

Retrieved from "http://www3.math.tu-berlin.de/jreality/mediawiki/index.php/Eclipse_set-up_tutorial"

This page has been accessed 15,861 times. This page was last modified 16:41, 6 November 2013.