Onboard Java Compiler

From Gumstix User Wiki
Revision as of 04:06, 10 April 2011 by Alxx (Talk | contribs) (created page)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To install a java vm , a compiler and runtime library.


Pre-requisites

Need to have these packages installed

task-native-sdk

opkg install task-native-sdk

Installation

As root on a running gumstix with internet access.

If you don't have internet access on your gumstix, you can download the packages and copy them to the gumstix via usb drive. May take a few goes to get all the dependencies.

first add angstrom repo

echo 'src/gz angstrom-base http://www.angstrom-distribution.org/feeds/unstable/ipk/glibc/armv7a/base'
> /etc/opkg/angstrom-base.conf

Install class path

opkg install classpath
opkg install classpath-dev  

If you need the graphical classes

opkg install classpath-gtk

If you are using graphical classes/gui remember to export the display

export DISPLAY=:0.0

Install cacao vm

opkg install cacao

Install jikes java compiler

opkg install jikes

If you need a java vm with debuging or remote debugging support or wish to use the phoneme jvm

wget http://bugcommunity.com/downloads/files/phoneme-advanced-personal-debug_mr2-r1_armv6.ipk
opkg install -force-depends phoneme-advanced-personal-debug_mr2-r1_armv6.ipk


Once everything is installed and your ready to run.

Set the bootclass path so jikes can find the classes

export BOOTCLASSPATH=/usr/share/cacao/vm.zip:/usr/share/classpath/glibj.zip


then with the standard java hello world

vim Hello.java
/* Hello.java */
public class Hello
{
  public static void main(String[] args)
  {
    System.out.println("Hello world!");
  }
}

Save then compile

alxx@omap1:~$ jikes Hello.java
alxx@omap1:~$ ls
Hello.class  Hello.java

Run it using cacao

alxx@omap1:~$ java Hello
Hello world!
alxx@omap1:~$

Run it using phoneme

alxx@omap1:~$ java-cdc Hello
Hello world!
alxx@omap1:~$