12/04/14

Repast on Linux (Crunchbang/Debian)

This is the second time I try to install Repast Symphony (ABM platform based on Eclipse) on Linux, and finally I'm successful. It is not difficult, but I had a few problems in following directly their guidelines.

These instructions are for Repast Simphony 2.1, released on 12 August 2013. The guidelines are taken from http://repast.sourceforge.net/download.php.
1. download eclipse standard 4.3 and move it in /opt/repast
2. run it, click on Help > Install New Software, then Work with:
  • From Kepler update site choose (you can use the search panel)
    • GMF Tooling 3.1.0
    • GMF Tooling Runtime Extensions 3.1.0
  •  From the Groovy Update Site
    • Extra Groovy Compilers
    • Groovy-Eclipse 
  • From the Repast Symphony update site
    • Repast Symphony
At this point if you run Repast, Eclipse should open a ReLogo perspective. Is it the case? For me, it wasn't. I couldn't create any ReLogo projects either. And I wasn't able to scope why, anywhere. I'm on Crunchbang 11, but I had the same problem on a Debian environment (not strangely, Crunchbang is built on Debian). The problem is that Crunchbang (and Debian) usually refer to openjdk java 6, while Repast requires openjdk java 7.
3. install openjdk java 7 via Synaptic
4. change the current java environment
$ sudo update-alternatives --config java
5. download the Repast demonstration models
6. import them as new projects in Eclipse

At this point eclipse gives this critical error: the container 'Repast Simphony Development Libraries' references non existing library '/opt/repast/plugins/libs.bsf_2.1.0/lib/bsf.jar'.

While eclipse is installed in /opt/repast, the plugins are installed in my home. As observed here, I need to put some symbolic links.

7. Go where the user copy of eclipse is installed, usually something like:
$ cd ~/.eclipse/org.eclipse.platform_4.3.##version##/plugins
8. Create symbolic links using the absolute path:
$ ls | xargs -I targ sudo ln -s /home/##username##/.eclipse/org.eclipse.platform_4.3.##version##/plugins/targ /opt/repast/plugins/targ
9. At this point, we have almost finished, I have still an eclipse error “Import cannot be resolved” for most of the imported projects. Go in Project > Clean... 
and clean them all. For me this was sufficient, here you find other solutions as well.

10. Trying to run, my eclipse gives an error "Exception in thread "main" java.lang.UnsupportedClassVersionError: repast/simphony/runtime/RepastMain : Unsupported major.minor version 51.0". The problem is still a wrong setting for jre/jdk (see here). So in Window > Preferences > Java > Installed JREs selects for instance java-7-openjdk-etc. If you don't have you have to add it as Standard VM, usually you should find it in usr/lib/jvm.


    Nessun commento:

    Posta un commento