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 http://cygwinports.org/ports.gpg
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 http://cygwinports.org/ports.gpg
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 Test.java
11. Run jamvm.exe Test
Some of the dependencies established through jamvm install:
 http://jamvm.sourceforge.net/ (1.5.3)
Saturday, April 7, 2012
Sunday, April 1, 2012
The euler project problem reads as such, "If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000."
Here is one of many implementations in Haskell. I used a verbose recursive approach, iterate up to 1000 and then build a list with the items of interest. In this case, 'multiples of 3 or 5'. The first implementation contains a logging utility for writing a string at each iteration.
|Figure 1: Euler Problem1 in Haskell|
Here is the second source snippet, I just wanted to provide something more practical, a log parsing example that you can run against your web log files.
|Figure 2: Applied Haskell, simply read each line of a file, find a term and output the results to another file.|