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.
Prerequisites: JDK, Eclipse, and SVN:
1. Download and install the most recent JDK (Java Development Kit)
You need Java SE Development Kit 6 or higher.
If you don't know Java yet, follow the tutorial:
2. Install Eclipse IDE for Java Developers
(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.
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:
Check out JReality source code with Git
For cloning the master branch of JReality, please follow this tutorial:
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.
Now go to the menu: Run->Run As...->Java Application or click the run icon:
You should see an app frame like this:
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:
In the following dialog, select Workspace, and choose the folder that matches your OS:
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:
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:
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:
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.