Difference between revisions of "Onboard Java Compiler"

From Gumstix User Wiki
Jump to: navigation, search
(created page)
 
m (Installation)
Line 41: Line 41:
  
  
Once everything is installed and your ready to run.
+
Once you have installed it add cvm to your path or create a symbolic link
   
+
cvm is in /usr/lib/jvm/phoneme-advanced-personal-debug/bin
 +
 
 +
  sudo ln -s  /usr/lib/jvm/phoneme-advanced-personal-debug/bin/cvm /usr/bin/cvm
 +
 
 +
== Set the classpath for Jikes ==
 +
 
 
Set the bootclass path so jikes can find the classes
 
Set the bootclass path so jikes can find the classes
 
  export BOOTCLASSPATH=/usr/share/cacao/vm.zip:/usr/share/classpath/glibj.zip
 
  export BOOTCLASSPATH=/usr/share/cacao/vm.zip:/usr/share/classpath/glibj.zip
  
 +
== Testing the install ==
 +
Once everything is installed and you are ready to run.
  
then with the standard java hello world
+
First check the versions
 +
 
 +
alxx@omap1:~$ java -version
 +
java version "1.5.0"
 +
CACAO version 0.99.4
 +
Copyright (C) 1996-2005, 2006, 2007, 2008
 +
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 +
This is free software; see the source for copying conditions.  There is NO
 +
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 +
 
 +
alxx@omap1:~$ java -fullversion
 +
java full version "cacao-1.5.0"
 +
 
 +
alxx@omap1:~$ cvm -version
 +
Product: phoneME Advanced (phoneme_advanced_mr2-b97)
 +
Profile: Personal Profile Specification 1.1
 +
JVM:    CVM phoneme_advanced_mr2-b97 (mixed mode)
 +
alxx@omap1:~$
 +
 
 +
 +
Then with the standard java hello world
 
  vim Hello.java
 
  vim Hello.java
 
  /* Hello.java */
 
  /* Hello.java */
Line 68: Line 95:
 
  Hello world!
 
  Hello world!
 
  alxx@omap1:~$
 
  alxx@omap1:~$
 +
 +
or
 +
alxx@omap1:~$ cacao Hello
 +
Hello world!
 +
alxx@omap1:~$
 +
  
 
Run it using phoneme
 
Run it using phoneme
  alxx@omap1:~$ java-cdc Hello
+
  alxx@omap1:~$ cvm Hello
 
  Hello world!
 
  Hello world!
 
  alxx@omap1:~$
 
  alxx@omap1:~$
 +
 +
Test phoneme using its provided testclasses.zip
 +
alxx@omap1:~$cvm -cp /usr/lib/jvm/phoneme-advanced-personal-debug/testclasses.zip HelloWorld
 +
Hello world.
 +
alxx@omap1:~$
 +
 +
 +
phoneme with some extra files can be used to run javascript , jython and servlets
 +
see http://www.nslu2-linux.org/wiki/HowTo/UseJavaOnTheSlug

Revision as of 03:42, 10 April 2011

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 you have installed it add cvm to your path or create a symbolic link cvm is in /usr/lib/jvm/phoneme-advanced-personal-debug/bin

sudo ln -s  /usr/lib/jvm/phoneme-advanced-personal-debug/bin/cvm /usr/bin/cvm 

Set the classpath for Jikes

Set the bootclass path so jikes can find the classes

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

Testing the install

Once everything is installed and you are ready to run.

First check the versions

alxx@omap1:~$ java -version
java version "1.5.0"
CACAO version 0.99.4
Copyright (C) 1996-2005, 2006, 2007, 2008
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
alxx@omap1:~$ java -fullversion
java full version "cacao-1.5.0"
alxx@omap1:~$ cvm -version
Product: phoneME Advanced (phoneme_advanced_mr2-b97)
Profile: Personal Profile Specification 1.1
JVM:     CVM phoneme_advanced_mr2-b97 (mixed mode)
alxx@omap1:~$ 


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:~$

or

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


Run it using phoneme

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

Test phoneme using its provided testclasses.zip

alxx@omap1:~$cvm -cp /usr/lib/jvm/phoneme-advanced-personal-debug/testclasses.zip HelloWorld
Hello world.
alxx@omap1:~$


phoneme with some extra files can be used to run javascript , jython and servlets see http://www.nslu2-linux.org/wiki/HowTo/UseJavaOnTheSlug