Updated: 11/5/2005; 6:05:29 PM.
Chris Double's Radio Weblog
        

Wednesday, March 03, 2004

JamVM is a JVM implementation designed to be small and portable. The stripped executable on Intel is only 80K. It has recently been ported to the Zaurus.

6:45:04 PM      

In my Scheme based web application framework, for development work I use the Jetty Webserver for testing.  I then deploy on Tomcat or IBM Websphere. The nice thing about Jetty is it is easily embeddable and I can run it from the Scheme REPL. This allows me to dynamically add to and modify the system from Scheme while it is running.

Unfortunately there are some issues with Jetty and the IBM v1.3.1 JVM. Jetty uses the Java API call Calendar.setTimeInMillis which is declared 'public' in Sun's documentation. In IBM's implementation it is 'protected' and compilation fails. As a workaround I had to change all calls to this function as follows:

Was:
  gc.setTimeInMillis(date);

Changed to:
  Date d = new Date();
  d.setTime(date);
  gc.setTime(d);

So much for Java portability.


3:08:53 PM      

I had to make some modifications to Sisc Scheme v1.8.7 to get it to run under IBM's v1.3.1 JDK. While rock solid under Linux, this JDK does have some 'issues' in the class library area. The original problem was running Sisc and occasionally getting the following error:

    String index out of range: 1

After some research I found it was occurring when parsing Sisc source files if it found a '.'. For example the following code:

    (define (test . args) (do-something args))

On hitting the '.' it would check to see if it was a number. Sisc uses the Java BigDecimal class to do this. Usually when BigDecimal fails to parse a number if throws a java.lang.NumberFormatException. Sisc catches this and continues parsing the source code. IBM's v1.3.1 JDK throws the StringIndexOutOfBoundsException instead, which Sisc catches and stops parsing as an unexpected error.

The fix was to modify Sisc to catch the java.lang.StringIndexOfOutBoundsException and re-throw it as a NumberFormatException.

Java, write once, test everywhere, fix for each individual JVM.

3:00:53 PM      

Speaking of Java Virtual Machines. I quite often get Hotspot internal errors when running some Java applications under Linux. Most noticeably this happens when running my Sisc Scheme based web application framework. Doing some research on the web I find that these hotspot internal errors are fairly common under Linux. As a workaround I found that IBM's V1.3.1 JDK works fine. No internal errors at all. Yet I get at least 3-4 a day using Sun's V1.3 or V1.4 JDK's.

2:51:18 PM      

Note to self. I was doing an upgrade to my Gentoo system using:
  emerge sync && emerge update -UD world
The problem I had was it was insisting that it wanted to upgrade my ibm-jdk installation from V1.3 to V1.4. I wanted to stick to version 1.3 as it is required for some of the applications I run. The workaround to force it not to upgrade this package was to edit '/etc/portage/package.mask' and add the line 'dev-java/ibm-jdk'. The 'etc/portage' directory didn't exist so I had to create it first.

2:49:01 PM      

© Copyright 2005 Chris Double.
 
March 2004
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Feb   Apr



Click here to visit the Radio UserLand website.

Listed on BlogShares

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.