Slashdot Mirror


Ruby and Java Running in JavaScript

John Resig is reporting on his blog that a recent trip to Tokyo opened up some very interesting JavaScript projects to him that haven't met with widespread popularity outside of Japan yet. "One project, in particular, really caught my eye. It's called Orto and is an implementation of the Java Virtual Machine (JVM) in JavaScript. This means that you can take an existing Java application, compile it to bytecode, run it through Orto (which produces the JavaScript, and embed it in a web page. While it doesn't provide the full capabilities of most Java code it does provide enough to make for some interesting demos." In a separate post he also detailed how the HotRuby project is allowing a Ruby VM to run in a browser using JavaScript or even indirectly using ActionScript in Flash.

2 of 220 comments (clear)

  1. Re:Doing things the slow way by Dekortage · · Score: 5, Informative

    The article suggests that the speed was not bad. (The sample Tetris clone loaded very quickly for me.) And the article's commenters note that this runs on an iPhone. In other words, Orto could be a route to port Java apps to be iPhone aps.

    --
    $nice = $webHosting + $domainNames + $sslCerts
  2. Re:Doing things the slow way by asdfghjklqwertyuiop · · Score: 5, Informative

    what i can't stand is java's complete lack of accuracy in basic math such as

    int upper = (int) (value * 100.0);
    double newVal = ((double)upper) / 100.0;

    value can start as an int/double/float your choice.

    in the end newValue does not alwasy equal value.. even though it should.. i understand floating point errors but i first saw this cause a problem with value being a double 8.12


    What language can you stand, then?

    % perl
    print int(8.12*100.0)/100.0;
    8.11
     
    % python
    Python 2.4.4 (#2, Apr 5 2007, 20:11:18)
    [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> float(int(8.12*100.0))/100.0
    8.1099999999999994
     
    % php5
    <?= floor(8.12*100.0)/100.0; ?>
    8.11
     
    % cat > test.c
    #include <stdio.h>
    int main() {
        double val; int upper; double newval;
     
        val = 8.12;
        upper = (int)(val * 100.0);
        newval = ((double)upper)/(100.0);
     
        printf("%f\n", newval);
    }
    % make test
    % ./test
    8.110000
     
    % ruby
    print (8.12*100.0).to_i.to_f/100.0;
    8.11