Building ReplicatorG With Eclipse

Prerequisites

Make sure you've installed the sources and tools as described on our building from source page, and that you've correctly installed the Eclipse IDE.

Creating the project yourself

  • Start Eclipse and select "File>New>Project…" from the menu. Select "Java Project from Ant Buildfile" from the wizard.
  • Select the "build.xml" file from the ReplicatorG directory as the Ant buildfile. Click "finish" to create the project.
  • All the additional libraries needed for build were automatically added by Ant but they should be manually re included from within "ReplicatorG/build" directory:
    • Right click on the project name, and select "Properties".
    • In the Properties dialog, select "Java Build Path".
    • Select the Libraries tab.
    • Press "Add External JARs…" (on the right side of the window).
    • Add all the JARs from within "build/shared/lib" directory.
    • Optional: Remove all the duplicated JARs.

If you intend to run ReplicatorG from Eclipse, you'll need to set up a launch configuration. When you do, be sure to add the native libraries for your platform to the VM arguments.

  • Still in the properties dialog, select "Run/Debug Settings". Click "New", then "Java Application". This will bring up the edit configuration dialog.
  • On the main tab, for a main class select "Base - replicatorg.app"
  • On the Arguments tab, add the library paths to the VM arguments.
    • For a Linux x86 build (tested on Linux Ubuntu 11.10), add: -ea -Djava.library.path=${workspace_loc:ReplicatorG}/build/linux/dist/lib-i686 -Dreplicatorg.app-resources=${workspace_loc:ReplicatorG}/build/shared/lib -Djava.library.path=/usr/lib/jni
    • For a Linux x86-64 build (tested on Linux Ubuntu 11.10), add: -ea -Djava.library.path=${workspace_loc:ReplicatorG}/build/linux/dist/lib-x86_64 -Dreplicatorg.app-resources=${workspace_loc:ReplicatorG}/build/shared/lib -Djava.library.path=/usr/lib/jni
    • For a Windows build, add: -ea -Djava.library.path=${workspace_loc:ReplicatorG}/build/windows/dist -Dreplicatorg.app-resources=${workspace_loc:ReplicatorG}/build/shared/lib
    • For an OS X build, add: -d32 -ea -Xmx1G -Djava.library.path=${workspace_loc:ReplicatorG}/build/macosx/dist -Dreplicatorg.app-resources=${workspace_loc:ReplicatorG}/build/shared/lib

Linux Ubuntu 11.10

Casainho is developing on Linux Ubuntu 11.10 and he founds:

  • -Djava.library.path=/usr/lib/jni must be added to VM arguments on the Arguments tab of Run Configurations so Eclipse can use RXTX library.
  • on the first time, is needed to run ant run command on ReplicatorG source folder, using the terminal.
  • While Casainho ReplicatorG sources are on /home/cas/replicatorg, the Eclipse runs ReplicatorG as if is on Eclipse workspace and so not finding some folders needed. For Casainho, his workspace is on /home/cas/workspace_eclipse_java/ to where he had to link the folders examples, machines and scripts from the ReplicatorG sources folder using the following commands on terminal:
    • ln -s /home/cas/replicatorg/examples/ /home/cas/workspace_eclipse_java/ReplicatorG/
    • ln -s /home/cas/replicatorg/machines/ /home/cas/workspace_eclipse_java/ReplicatorG/
    • ln -s /home/cas/replicatorg/scripts/ /home/cas/workspace_eclipse_java/ReplicatorG/

Windows 7 64-bit builds

Mark Klunder recommends the following to get Eclipse builds working properly on 64-bit Windows 7 platforms:

To get ReplicatorG to execute on my Windows7 64bit edition under jdk 1.6.0_26 i had to do the following

Removed : JRE_Lib 
Added :   JRE System Library [jdk1.6.0_26]

Changed files to 64 bit versions 
-------------------------------------------------------------------------------------------
j3dcore-ogl.dll      :  Sourced from http://java3d.java.net/binary-builds.html
rxtxSerial.dll        :  Sourced from http://www.cloudhopper.com/opensource/rxtx/
RXTXcomm.jar     :  Sourced from http://www.cloudhopper.com/opensource/rxtx/

We'll try to get these libraries into the source tree soon.

Suppressing generics warnings

You may see many warnings when you first try to build your project of the form "XXX is a raw type". This is because much of the editor component was written in the late 90's, before generics were available in Java. These warnings can be safely ignored. You can suppress the warnings by changing the Java Compiler warning options in the project settings as shown below:

flickr:5237836037
Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.