Getting Started with JR Development on a Unix platform(Linux and Mac OS)

The repository is publicly accessible with read-only permissions. For write permissions, please contact a member of the javarosa-developers community.

At the time of writing this page, the author used OpenSuse 10.3. OpenSUSE 11.0 was buggy. It would be nice to use a stable distro that can allow eclipse to run ably. For instance eclispe worked well with OpenSuse 10.3 and earlier versions.

Setting Up the Development Environment

Several of these installs are not small, make sure you are on a stable connection when you try to download them. Please use the versions listed below to avoid problems.

Install Java Standard Edition Development Kit(JDK) 5.0 or later

Check if java 1.5 or later is installed on your system. Type java -version to confirm
e.g.

smuwanga@linux-simon:~> java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode)


FYI: Java is installed by default on most unix distributions If there is no java, visit  http://www.wikihow.com/Install-Java-on-Linux

Install Sun Java Wireless Toolkit for CLDC v 2.5.2.

Download the wireless toolkit from  http://java.sun.com/products/sjwtoolkit/download.html . You should download the version that suites your system's architecture.

Extract it to a directory of your choice.

Install Eclipse IDE for Java Developers

Install EclipseME, a J2ME plugin

There are two ways of adding EclipseME to eclipse You can download it from the internet through eclipse or you can pick it from an archive. Follow this link( http://eclipseme.org/docs/installEclipseME.html ) for details.

Install subversion

Depending on the desktop type you chose during the installation of your OS. For KDE users, go to yast and install kdesvn. Here are the details.

  • Ensure your DVD for the OS is inserted into the DVD-Drive
  • Click on the K Menu,
  • Click on Computer submenu, click on Administrator Yast Settings
  • Supply your password to open yast as root.
  • Go to Software>>Software Management>>
  • Follow the prompts till you reach a window that allows to search for any installed software package.
  • On the left pane of that window, type in kdesvn and hit the Enter Button.
  • Check kdesvn if its not checked.
  • Click the Accept button
  • Wait for it to install till Finsh.

Install J2ME-Polish v2.0.4

  • A window for J2mepolish appears, click Next button
  • Read and accept the terms of the license agreement
  • Choose a location where to install j2mepolish. That location will later become the j2mepolish home.
  • Click Next button, click on the first Choose button to specify the location where you extracted the wireless toolkit.
  • Click Next button, and follow the prompts till you see the Finish button.

Configure Eclipse to support Polish

  • Create a directory called javarosaWorkspace anywhere you want in your computer(this should be in your profile, not as root). For instance mine is a /home/smuwanga/javaRosaWorkspace
  • Using your mouse, open the directory where eclipse was extracted.

e.g. /home/smuwanga/software/applications/eclipse

  • Click on the blue icon(its a linux executable file) to launch eclipse. A small window called Workspace Launcher loads.
  • Click on the Browse button, and locate our directory called javarosaWorkspace that we created earlier
  • Click Ok. You should see a welcome window dotted with icons like Overview, tutorials and so on...
  • On the Menu bar, got to Window>> Preferences>> J2ME
  • On the Right side of the window, In Antenna Settings, WTK Root, click on Browse button to locate the directory where you extracted the wireless toolkit. Mine is /home/smuwanga/software/WTK2.5.2
  • Click on Apply button
  • Back to the Left pane, click node for J2ME, select Device Management,
  • Click on Import button,
  • Click Browse button, locate the WTK2.5.2 directory,
  • Click the Refresh button, and wait for devices to be loaded
  • Click Finish
  • Choose a device of your own, if the default(Media Control Skin) doesn't make you happy.
  • After click on Apply.
  • Click Ok button.

Getting the code

  • Create a directory, lets call it javarosaCode
  • Right-click on it, and choose Open with kdesvn, an SVN Error window should appear, click Ok button
  • On the Menu bar, go to Subversion>> General >> Checkout a repository, you should see a window called Checkout a repository – kdesvn
  • In the Enter URL field, paste the  http://code.dimagi.com/svn/JavaRosa/trunk/
  • In the Select target directory field put the location of the javarosaCode directory or click on the blue icon and locate the javarosaCode directory

e.g. /home/smuwanga/javarosaCode

  • Click Ok
  • Wait for kdesvn to pull out the code from the repository. This depends on your network connection. It normally indicates that the check-out has finished.

Loading the code into eclipse

  • Go to File menu, click Import, a new window opens up
  • Click on the node of General, there you should a drop-down
  • Click on Existing Projects into Workspace, then click on the Next button
  • Ensure the Select root directory radio button is selected. If not, select it, and click on the Browse button to locate the directory into which the code was checked out. That directory would be /home/smuwanga/javarosaCode
  • Click Finish. All the projects should appear on the left pane of the eclipse window

Building the Code

  • The main project to use is org.javarosa.demo. It has dependencies to the other projects, enumerated both in its .classpath file, and its build.xml file.
  • Open the org.javarosa.demo project.
  • Open the build.properties file.
  • Ensure the polish.home variable is set to the location of J2ME-Polish on your system.

polish.home=/home/smuwanga/software/applications/J2ME-Polish

  • Ensure the wtk.home variable is set to the location of the Sun Wireless Toolkit on your system.

wtk.home=/home/smuwanga/software/WTK2.5.2

Repeat for any vendor-specific toolkits. If you have none, or preferably for the beginning comment out the following

    -palm.weme.home
    -palm.simulator.home
    -nokia.home
    -sony-ericsson.home

FYI: use a hash symbol(#) to comment, So for the above variables, do it like this;

  #palm.weme.home=C:\\Program Files\\Palm\\PalmOS JVM 5.7.2
  #palm.simulator.home=C:\\Program Files\\Palm\\PalmOS_Garnet_51_Simulator
  #nokia.home=C:\\Nokia
  #sony-ericsson.home=C:\\SonyEricsson\\JavaME_SDK_CLDC
  • Set the app.class variable is set to the name of the MIDlet you wish to run.
  • Click on the Sava icon, that graces on the toolbar, or press Ctrl+S

* close the following projects(right-click on the project, select close)

-org.javarosa.communication.bluetooth.client
-org.javarosa.communication.bluetooth.server

Since the work has been submitted by different people, you have change the build paths of most projects

  • Right-click on each project, begin with the first one at the top of the left-pane in eclipse.
  • Select Build Path>> Configure Build Path. A new window opens. On the right-pane, click on the Libraries tab
  • You'll notice that some paths are faulty. E.g J2ME Library(failed to get library information)
  • Click on the J2ME node, on the left pane. On the right, you should see a Device groupbox
  • Click on Manage Devices button
  • Click on Import button,
  • Click Browse button, locate the WTK2.5.2 directory,
  • Click the Refresh button, and wait for devices to be loaded
  • Click Finish
  • Choose a device of your own, if the default(Media Control Skin) doesn't make you happy.
  • After click on Apply.
  • Click Ok.

Defining Variables in eclipse e.g. J2ME_POLISH_HOME

  • Right-click on each project, begin with the first one at the top of the left-pane in eclipse.
  • Select Build Path>> Configure Build Path. A new window opens. On the right-pane, click on the Libraries tab
  • Click on Add Variable button
  • Click on Configure Varialbles button
  • Click on New button
  • In the new pop up window called New Variable Entry, for Name: type the variable's name; for this case J2ME_POLISH_HOME

for Path: click on the Folder button

  • Follow the prompts and restart eclipse

So go checking every project like that. Where you get stack, present it to the JavaRosa Chat. At this point you can begin working with windows developers on how to trace other build errors.

  • Right click on the build.xml file and select Run As -> Ant Build.