Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming Java IT Technology

Ruby and Java Running in JavaScript 220

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.
This discussion has been archived. No new comments can be posted.

Ruby and Java Running in JavaScript

Comments Filter:
  • But... (Score:5, Interesting)

    by Oxy the moron ( 770724 ) on Monday April 28, 2008 @03:17PM (#23228386)

    Does it run Linux? ;)

    In all seriousness, though... I'm struggling to see how this is truly beneficial. Aren't most pages already hopelessly clogged with mounds of JavaScript? Is it that difficult to expect a user to have a Java interpreter already installed when they visit the page such that having your Java "emulated" in JavsScript is the better solution?

    Just seems like a solution needing a problem to me.

  • by gstoddart ( 321705 ) on Monday April 28, 2008 @03:20PM (#23228422) Homepage

    What this is, basically, is emulating the Java in Javascript, an interpreted language. I can't help but feel that anything written in this is going to be very slow, and I can't, personally, see why anybody would bother

    I'm with you, I read the summary and almost choked on my coffee.

    This is like writing a Cray emulator for your TI 99/4a -- I don't know what it buys you.

    Of course, I'd be very happy to be proven wrong!

    I'm sure some clever person will put out a demo showing something completely amazing, and I'd love to see it. For now, it sounds like "because we can" sorta stuff (not that there's anything wrong with that).

    Cheers
  • Google Web Toolkit (Score:5, Interesting)

    by mysqlrocks ( 783488 ) on Monday April 28, 2008 @03:20PM (#23228424) Homepage Journal
    While not exactly the same thing, the Google Web Toolkit [google.com] (GWT) lets you write your code in Java and then run it in the browser. The difference is that the GWT translates the Java into JavaScript instead of giving you a full JVM. I'm not sure what practical advantage having a full JVM gives you.
  • Strange (Score:5, Interesting)

    by graveyhead ( 210996 ) <fletchNO@SPAMfletchtronics.net> on Monday April 28, 2008 @03:22PM (#23228444)
    Seems odd to use languages that weren't really designed to be embedded in a browser. One of the nice things about Javascript in the past couple of years has been the great DOM support. Add a library like JQuery [jquery.com] and you have full cross platform goodness and a sane way to write code. Getting Java or Ruby code to interact with the DOM seems like it would be a huge pain compared with JQuery.

    Why does everyone hate Javascript so? If you're going of cut-n-paste examples from the web yes it looks like an ugly language. Check out how the OO stuff works, or some JQuery code, and you'll be pleasantly surprised.
  • Re:Awesome! (Score:3, Interesting)

    by nmb3000 ( 741169 ) on Monday April 28, 2008 @03:56PM (#23228820) Journal
    Finally, a way to combine the feature-rich capabilities of Javascript with the speed of Java!

    Cynicism was my initial response as well, but reading TFA shows a pretty cool demo [accelart.jp]. The fact that they are able to convert Java's user input events, GUI, and multithreading to Javascript is pretty cool. Probably has no practical use, but still cool.

    If nothing else it means that the next time (in about 3 minutes if today is a normal day) somebody gets Java and Javascript confused, I can say they really ARE "basically the same thing" now!
  • by evanbd ( 210358 ) on Monday April 28, 2008 @04:19PM (#23229126)

    Why wouldn't I code in Java? For most things I code, I see about a 10-20% performance penalty vs C, plus a modest load time (that I don't care about usually). I also see a noticeably reduced development time; for me that's a trade worth making under most circumstances. Now, I'm not coding user interfaces, and I am paying attention to performance of my Java code (unlike many Java developers). I'm also emphatically not claiming it's a good environment for everything (but I'd say the same about any language / platform). For what I do, it does a good job of balancing speed and ease of development and a number of other things.

    If you'd like to claim that Java is universally slow, I have a program spec you're welcome to implement in the language of your choice for comparison. I'll warn you, though, the last time someone implemented it in C++ it came out slower (though once I pointed out the subtle algorithmic difference between our implementations, the C++ won by 10-20%).

  • by Instine ( 963303 ) on Monday April 28, 2008 @04:35PM (#23229302)

One way to make your old car run better is to look up the price of a new model.

Working...