Page 1 of 1

Install the MembraneEditor from Source with Eclipse

Posted: 07.07.2012, 11:02
by bjoern
Introduction

In this article I show you how to install the MembraneEditor from source using Eclipse. For an experienced user of Eclipse, this is a task which takes ca. 5 minutes. This tutorial explains in detail every step also for people not familiar with Eclipse.


Requirements

Make sure you have installed:

Java JRE from e.g. http://www.java.com
On many systems this is pre-installed. In addition it is possible to download it together with Eclipse in the next step. For Linux usually it is better to choose the original Sun Java instead of alternative Java version. But it may run also with the alternatives.

Eclipse for/with Java (the project runs also on very old version like 1.3) from e.g. http://www.eclipse.org/downloads/

Finally, download Java3D from http://java3d.java.net/binary-builds.html/
It is recommended to choose version 1.5.2 which is not available from Oracle.


Import and Compile the Project

The source code can be downloaded from:

http://www.cellmicrocosmos.org/index.php/download

Please always choose the newest version.

After you have downloaded the ZIP file, extract the contained files.

Now open Eclipse. Right click into the package explorer onto an empty position (make sure you do not selected accidently another already imported project) and choose "Import".
Eclipse: Import Project
Eclipse: Import Project
file_004.png (28.71 KiB) Viewed 26442 times
In the appearing menu, choose "General -> Existing Projects into Workspace".
Eclipse: Import Dialog
Eclipse: Import Dialog
file_008.png (30.74 KiB) Viewed 26442 times
Choose the folder which you have extracted before. Make sure that the selected folder contains the folder "org" , otherwise Eclipse will not find the project file. Click "OK".
Eclipse: Search Folder
Eclipse: Search Folder
file_003.png (12.34 KiB) Viewed 26442 times
Now the Import dialog should look like this:
Eclipse: Import Project
Eclipse: Import Project
file_011.png (23.83 KiB) Viewed 26442 times
Select "copy projects into workspace" if you want to copy the whole project into the workspace. (Otherwise Eclipse will use the extracted folder as source and you can not delete this folder again without destroying the project.)

Make sure that in Projects the folder "Cm2_2" is selected. This is the project to be imported. Click on "Finish".

Now your package explorer should look like this:
Eclipse: Project Imported
Eclipse: Project Imported
file.png (26.25 KiB) Viewed 26442 times
Note that there is an exclamation mark found besides the "Cm2_2" folder. This indicates that some libraries are not linked correctly. The reason is that usually your Java libraries are found on another location than on the computer the project originally was exported. But this is not problem. Right click onto "Cm2_2" in the Package Explorer and choose "Properties".
Eclipse: Choose Properties
Eclipse: Choose Properties
file_014.png (36.76 KiB) Viewed 26442 times
Choose "Java Build Path" in the left menu. Choose the tab "Libraries" in the right menu. Note the error mark besides the Java library and the "unbound" information: there is not Java library found in the predefined location. Select it and click on "Remove".
Eclipse: Select Java Library
Eclipse: Select Java Library
file_005.png (47.51 KiB) Viewed 26442 times
Click on "Add Library", select "JRE System Library" and select now a Java library which is installed on your computer. Usually you can choose "Workspce default ...". The MembraneEditor is compatible to Java 6 and, starting with version 2.2.1_2, also to Java 7 (there were only minimal problems before). After selecting the Java library, click on "Finish".
Eclipse: Choose Workspace Default
Eclipse: Choose Workspace Default
file_009.png (20.51 KiB) Viewed 26442 times
You will see: the exclamation mark disappeared. Click "Okay".
Eclipse: Java imported
Eclipse: Java imported
file_002.png (46.47 KiB) Viewed 26442 times
If there are no more error messages by now, you can skip the next step:
Usually, there should be not compiler problems by now. But sometimes Eclipse uses some strange settings for the Java version. And in this cases, you have to do the following:

Richt click on the project in the Package Explorer. Choose again "Properties". Select "Java Compiler" on the left side of the window. Check the Java version stated for "Compiler compliance level". Here should be written "1.6" in the best case, "1.7" works also. But e.g. "1.4" will not work. In this case, select "Enaple project specific settings". The choose the appropriate Compiler compliance level (1.6 is recommended). Click "Okay".
Eclipse: Java Compiler
Eclipse: Java Compiler
file_007.png (31.72 KiB) Viewed 26442 times
Make sure that Eclipse recompiles the project by choosing "Procect -> Clean ..." and press okay in the clean dialog. Now all errors should be disappeared.
Eclipse: Clean Project
Eclipse: Clean Project
file_013.png (16.9 KiB) Viewed 26442 times
On some systems (usually only Windows XP), the project may run now. Just try to start it. Navigate in the Package Explorer to org.cellmicrocosmos.cm2.Start.java:
Eclipse: Start
Eclipse: Start
file_006.png (53.43 KiB) Viewed 26442 times
Right click on the project and select "Run as ... -> Java application":
Eclipse: Run as
Eclipse: Run as
file_012.png (64.83 KiB) Viewed 26442 times
If you are lucky, the project will already start, because Java 3D was linked with Java properly. But usually, especially on Linux or Windows 7, this will not work. But this problem is solved very easily: Define the location of the Java 3D binary file. (Skip the following step if you succeeded in starting the MembraneEditor.)

For this purpose, you have to link the Java 3D binary file with Java. Right click again onto the project in the Package Explorer and open the properties. On the left side, select Java Build Path. On the right side, double click on the "Native library location" found in the Java library (e.g. "JRE System Library [jre6]"). Now navigate here to the folder where the binary file of Java 3D is found:

Windows XP:
C:\Programme\Java\Java3D\1.5.2\bin

Windows 7: Make sure that you use a 32 bit version of Java 3D if you use a 32 bit version of Java and a 64 bit version of Java 3D with a 64 bit version of Java.
64 bit:
C:\Program Files\Java\Java3D\1.5.2\bin
32 bit:
C:\Program Files (x86)\Java\Java3D\1.5.2\bin

Linux (Ubuntu):
usr/lib/jni
Eclipse: Java 3D Binary
Eclipse: Java 3D Binary
file_010.png (55.23 KiB) Viewed 26442 times
Now you can run the MembraneEditor by starting the Start.java stated above. In addition you can now read the section Tune the MembraneEditor! Part I: Fun with Java Heap Space.

Moreover, if you own a nVidia Quadro FX card and 3D-Stereoscopy-compatible monitor, it is about time to activate the 3D mode! Go to Tune the MembraneEditor! Part II: Fun with 3D-Stereoscopy.