Difference between revisions of "Java"

From Chumby Wiki
Jump to: navigation, search
(Too lazy to do all this?)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''NOTE: this page is under development'''
+
Here's how to build a simple java virtual machine for the chumby (assumes you have the development tools installed).
  
How to build a simple java virtual machine for the chumby (assumes you have the development tools installed):
+
Or you can skip to the end and just download a prebuilt binary.
  
 
=Building JamVM=
 
=Building JamVM=
Line 9: Line 9:
  
 
==Download the source code==
 
==Download the source code==
Go [http://prdownloads.sourceforge.net/jamvm/jamvm-1.4.3.tar.gz?download here] and download the source code into <code>~/jamvm</code>
+
Download [http://prdownloads.sourceforge.net/jamvm/jamvm-1.4.3.tar.gz?download jamvm-1.4.3] into <code>~/jamvm</code>
  
 
==Unpack the source code==
 
==Unpack the source code==
Line 25: Line 25:
 
  sudo make install
 
  sudo make install
  
This will copy the virtual machine to <code>/usr/arm-linux/jamvm</code>, and the basis class libraries to <code>/usr/arm-linux/share/classes.zip</code>
+
This will copy the virtual machine to <code>/usr/arm-linux/jamvm</code>, and the custom class libraries to <code>/usr/arm-linux/share/classes.zip</code>
 +
 
 +
==Download and unpack GNU classpath==
 +
mkdir ~/classpath
 +
cd ~/classpath
 +
Download [ftp://ftp.gnu.org/gnu/classpath/classpath-0.91.tar.gz classpath-0.91]
 +
tar -xzf classpath-0.91.tar.gz
 +
cd classpath-0.91
 +
 
 +
==Build classpath==
 +
You'll need to have jikes installed (for Kubuntu, <code>sudo apt-get install jikes</code>)
 +
./configure --build=i386-linux --host=arm-linux --prefix=/usr/arm-linux --with-jikes --disable-gtk-peer --disable-alsa --without-x --with-jni
 +
make
 +
sudo make install
 +
 
 +
==Build a "java dongle" for chumby==
 +
* copy <code>/usr/arm-linux/bin/jamvm</code> to the dongle
 +
* create a directory <code>lib</code> on the dongle
 +
* copy <code>/usr/arm-linux/share/classes.zip</code> to the <code>lib</code> directory on the dongle
 +
* copy the contents of<code>/usr/arm-linux/lib/classpath/*.so</code> to the <code>lib</code> directory on the dongle
 +
* copy the contents of<code>/usr/arm-linux/share/classpath/</code> to the <code>lib</code> directory on the dongle
 +
* create the file <code>java</code> on the dongle with the contents:
 +
#!/bin/sh
 +
LD_LIBRARY_PATH=/mnt/usb/lib /mnt/usb/jamvm -mx8M -Xbootclasspath:/mnt/usb/lib/classes.zip:/mnt/usb/lib/glibj.zip $@
 +
 
 +
==Too lazy to do all this?==
 +
Just download [http://files.chumby.com/languages/java/jamvm_chumby_1.7.tar.gz jamvm_chumby_1.7.tar.gz] (23MB) and unpack onto your dongle.
 +
 
 +
==Run programs!==
 +
 
 +
For example, if you have a program <code>Hello.java</code> compiled to <code>Hello.class</code>, you can run it with:
 +
# java Hello
 +
Hello World
 +
#

Latest revision as of 13:07, 30 May 2009

Here's how to build a simple java virtual machine for the chumby (assumes you have the development tools installed).

Or you can skip to the end and just download a prebuilt binary.

Building JamVM

Create a directory to hold the package

mkdir ~jamvm
cd jamvm

Download the source code

Download jamvm-1.4.3 into ~/jamvm

Unpack the source code

tar xzvf java-1.4.3.tar.gz
cd javavm-1.4.3

Configure and build

./configure  --build=i386-linux --host=arm-linux --prefix=/usr/arm-linux
make

Strip the binary

arm-linux-strip src/jamvm

Install

sudo make install

This will copy the virtual machine to /usr/arm-linux/jamvm, and the custom class libraries to /usr/arm-linux/share/classes.zip

Download and unpack GNU classpath

mkdir ~/classpath
cd ~/classpath

Download classpath-0.91

tar -xzf classpath-0.91.tar.gz
cd classpath-0.91

Build classpath

You'll need to have jikes installed (for Kubuntu, sudo apt-get install jikes)

./configure --build=i386-linux --host=arm-linux --prefix=/usr/arm-linux --with-jikes --disable-gtk-peer --disable-alsa --without-x --with-jni
make
sudo make install

Build a "java dongle" for chumby

  • copy /usr/arm-linux/bin/jamvm to the dongle
  • create a directory lib on the dongle
  • copy /usr/arm-linux/share/classes.zip to the lib directory on the dongle
  • copy the contents of/usr/arm-linux/lib/classpath/*.so to the lib directory on the dongle
  • copy the contents of/usr/arm-linux/share/classpath/ to the lib directory on the dongle
  • create the file java on the dongle with the contents:
#!/bin/sh
LD_LIBRARY_PATH=/mnt/usb/lib /mnt/usb/jamvm -mx8M -Xbootclasspath:/mnt/usb/lib/classes.zip:/mnt/usb/lib/glibj.zip $@

Too lazy to do all this?

Just download jamvm_chumby_1.7.tar.gz (23MB) and unpack onto your dongle.

Run programs!

For example, if you have a program Hello.java compiled to Hello.class, you can run it with:

# java Hello
Hello World
#