From jalimo (inactive) Wiki
Jump to: navigation, search

This article describes, how to get started, if you want to install and use Jalimo on OpenMoko based systems.


Install packages

Many Jalimo packages are part of the OpenMoko distribution and can be installed right away. For some very new packages this is not the case and you need to add a repository. See the packages page for detailed instructions.

opkg update && opkg install cacao classpath

Install the package classpath-awt to enable Swing and AWT support and install libswt3.4-gtk-java to get the Eclipse SWT working.

Hello World

public class HelloWorld {
	public static void main(String[] args) {
                System.out.println("Hello World");

Compile this sample code with any java compiler. Copy the HelloWorld.class to your Jalimo-enabled device (e.g. using scp, or WinSCP on Windows) and call

cacao HelloWorld

GUI Application

For GUI aplications, you have different opportunities at the moment.

  • AWT/Swing (package classpath-awt)
  • Java-gnome (Gtk bindings in Java) (package java-gnome-jalimo-2.10)
  • Eclipse SWT

We suggest using the SWT bindings at the moment, because Swing has a bad performance and java-gnome bindings do not provide a complete API coverage, yet.

SWT GUI Application

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.*;
public class Sample1 {
	public static void main(String[] args) {
		Display display = Display.getDefault();
		final Shell shell = new Shell(display);
		shell.setLayout(new RowLayout(SWT.VERTICAL));
		Label label = new Label(shell, SWT.CENTER);
		label.setText("Hello maemo");
		Button button = new Button(shell, SWT.NONE);
		button.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event arg0) {
		while (!shell.isDisposed())

Compile this sample code against the Eclipse SWT libaries using any java compiler. You can get the libraries from the SWT Homepage for different platforms) . Run the application on your host. Copy the Sample1.class to your jalimo enabled device (e.g. using scp, or WinSCP on Windows). Then login to your device and call

opkg install libswt3.4-gtk-java
cacao -cp /usr/share/java/swt-gtk.jar Sample1

IPK packaging

Of course an application needs a proper packaging. For OpenMoko this means packaging in .ipk archives. To make this easy, we have created a packaging plugin for apache maven (the de-facto standard build system for java). To use this plugin, simply create a maven project and add the evolvis plugin repository, as well as the packaging configuration to your pom.xml. You can find an example configurations here. After that, you simply have to run

mvn pkg:pkg -Ddistro=openmoko_2007.2

in your project to get a suitable .ipk archive. One of the benefits of the plugin is the capability to translate the Maven dependencies to OpenEmbedded package dependencies.

Building packages

Read the Building_with_OpenEmbedded page to get started with building packages on your own and participate on Jalimo.