Saturday, April 7, 2012

Build a java virtual machine that is actually readable/modifiable for Win32

Is it possible to build a Java virtual machine for Win32 in an sort of understandable way?  It is mostly impossible.  The OpenJDK build will take hours just to build and will take a day to prepare your environment.   If you aren't a core JVM developer, who actually is going to take several days to prep their environment so that they can hack OpenJDK.  The jikes RVM may work with cygwin/win32 but it is mostly designed for linux or some other open platform.  You are really only left with JamVM.  I was actually able to install all of the dependencies with cygwin and perform a build in 15 minutes.  And then actually edit the C source, add a log statement, rebuild and run against a bytecode class file.  JamVM is the only JVM project that is understandable (20-30 core C files) and the build actually works with a modern version of cygwin.

I will go through some of the setup.  It helps to actually install JamVM through cygwin.  Full install.

1. Run cygstart and use cygports as your cygwin repository.  Cygports allows you access to more software packages.

cygstart -- /cygdrive/c/Users/bbrown/Downloads/setup.exe -K

2. Select 'jamvm' and run through the installer.

I am installed 'jamvm-1.5.3-5'

3. Run cygstart -- /cygdrive/c/Users/bbrown/Downloads/setup.exe -K
Again but this time select 'jamvm' source install.  Double click on the text 'Keep' near jamvm.

4.  Change your directory to /usr/src.  The source for jamvm is located in the src directory.

5.  Install jamvm-1.5.3-5 based on the source:

Run cygport ./jamvm-1.5.3-5.cygport all

6.  Then run  cygport ./jamvm-1.5.3-5.cygport prep

7.  Then run  cygport ./jamvm-1.5.3-5.cygport compile

8. Enter '/jamvm-1.5.3-5/build/src'
9. Type 'make' and edit a C source file.

10. javac -source 1.5 -target 1.5
11. Run jamvm.exe Test



Some of the dependencies established through jamvm install:

ecj (3.5.2-1)
gnome-icon-theme (
java-classpath (0.98-2)
java-ecj (3.5.2-1)
libgtk2.0_0 (2.24.10-1)
libjbig2 (2.0-11)
libjpeg8 (8b-1)
libpango1.0_0 (1.29.4-2)
libpng14 (1.4.8-1)
libtiff5 (3.9.4-1)
libXext6 (1.3.0-1)
shared-mime-info (1.0-1)
xcursor-themes (1.0.3-1)


[2]  (1.5.3)

1 comment:

Admiral Adney said...

Tanks for the detailed post,this will really help me out in my upcoming task which is based on ruby application development. i am also looking forward for more post like this.