Slashdot Log In
Ruby and Java Running in JavaScript
Posted by
ScuttleMonkey
on Mon Apr 28, 2008 02:11 PM
from the fun-new-toys dept.
from the fun-new-toys dept.
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.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
Awesome! (Score:4, Funny)
Re: (Score:3, Interesting)
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 "basical
Re:Awesome! (Score:5, Funny)
Fantastic. Somebody's found a way to make the morons of the world slightly more correct without them even knowing it.
Parent
Re:Awesome! (Score:4, Informative)
Java is an object-oriented programming language originally released by Sun Microsystems in 1995. JavaScript is a functional scripting language originally derived from Ecmascript. Java requires a Java Virtual Machine to be installed on your computer or some other device like a mobile phone. Javascript runs right in your web browser. Javascript was originally named LiveScript, but through a marketing deal between Netscape and Sun, became named JavaScript, even though the two languages are unrelated, thus dooming those in the know to have to constantly correct people who refer to JavaScript as Java, assuming that "Java" is just like a nickname or something. However, they are both based on syntax that looks a good deal like C.
Parent
Doing things the slow way (Score:3, Insightful)
Re: (Score:3, Interesting)
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.
I'm sure some clever person will put out a demo showing something completely amazing, and I'd
Re: (Score:2)
Hey, I used to have a TI 99/4A. Great little machine, back then!
Re: (Score:2)
I'm not disparaging the TI 99/4a, I have very fond memories of that machine.
:-P
... making a scale model of a dump truck from a Yugo. Sure, it kinda mostly looks like a dump truck. But, it can't do any of the things you'd actually want a dump truck for. :-P
But, let's face it, that's just as odd a scenario as running Java on a javascript interpreter.
It's like
Cheers
Re: (Score:2)
Bah, give me enough monkeys and enough time, I'll give you all of the analogies you could ever want.
I've made the computer analogy, the car analogy, and now I've alluded to monkeys
Cheers
Re:Doing things the slow way (Score:5, Informative)
The article suggests that the speed was not bad. (The sample Tetris [accelart.jp] 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.
Parent
Re:Doing things the slow way (Score:5, Funny)
iPhone -> Orto -> Javascript -> Java -> C64 Emulator -> VIC-20 Emulator -> Zork I
Exciting New ways to be eaten by a grue!
Parent
Re: (Score:3, Informative)
Re:Doing things the slow way (Score:4, Insightful)
Tetris performed better on my Gameboy (an 8-bit, 4.2MHz x80 CPU with 8KB RAM) than this clone does on my 32-bit 1.4GHz Athlon. And it had sound. Tetris shouldn't load "quickly" it should load instantly.
This is a very clever hack, and I admire the work -- but it is in no way practical for anything. I find the idea of using it for "real work" apalling -- and I code in Java by choice!
Parent
Re: (Score:3, Interesting)
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 languag
Re: (Score:3, Insightful)
Re:Doing things the slow way (Score:5, Informative)
What language can you stand, then?
Parent
Re: (Score:2)
Tetris is not apt to use a great deal of java's vast libraries, so if you're smart about loading just the parts you need, when you need them, why shouldn't Java on Javascript Tetris be fairly close to plain old Javascript Tetris, with a modest constant time hit. What I'd like to see
Re: (Score:2)
Probably, it will be slow.
But, in general, just because something is interpreted doesn't mean it has to be slow. There are various ways to implement an interpreter, and interpreters can have either very fast start-up time or very fast execu
Re: (Score:2)
Is anyone here clear on the actual amount of processing power necessary to run a game of Tetris? Hint: It's not a lot. Especially if you're not using a fancy blitter with alpha-transparencies and pipelined transforms.
But... (Score:5, Interesting)
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.
Re: (Score:3, Informative)
Ruby and Java, and also Python (Score:4, Informative)
Google Web Toolkit (Score:5, Interesting)
Strange (Score:5, Interesting)
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:Strange (Score:4, Informative)
Parent
Re: (Score:2, Insightful)
Javascript is inherently multithreaded and embedded in a highly asynchronous environment, het has no threading API whatsoever. To me, this is mind-boggling. Every AJAX project I've been involved in has had to build in ugly workarounds or just drop features to prevent race conditions.
The Octoparrot of the programming world (Score:5, Funny)
I just need to get this out of my system (Score:5, Funny)
Re: (Score:3, Funny)
Re: (Score:2)
No Perl? (Score:4, Informative)
Re: (Score:2)
Re: (Score:2)
crazy japanese (Score:3, Funny)
that's pretty cool but man, talk about a daunting tedious task. I'd rather bail 600 acres with a weed wacker and twisty-ties.
Language stacks galore! (Score:5, Funny)
Now all we need to get is a C compiler to output python code. If someone can then write an x86 VM in python we could then run Linux in Firefox!
Re: (Score:3, Funny)
Re: (Score:3, Funny)
Re: (Score:3, Interesting)
Haskell, too (Score:2)
Re: (Score:2)
* Urk * (Score:3, Funny)
Re: (Score:2)
I know I twitched a little when I read the "Java in Javascript" part. A really neat hack, tho.
Thing is Internet Explorer has supported lots of languages - even those not meant for a web browser! - for writing full-featured client-server code. They're called viruses.
As a side note... (Score:3, Funny)
google Web Toolkit? (Score:2)
Why? (Score:2)
More important languages (Score:2)
Number #1 app (Score:3, Funny)
This is just a prototype! (Score:4, Funny)
Re: (Score:2)
Re:Java running under Javascript... (Score:4, Insightful)
By the way, you can obviously rewrite critical portions of Java code in C as well... Being able to call out to C is not an excuse for the current Python and Ruby implementations being complete trash. There are lots of languages that provide a similar level of abstraction that have far better performance and a threading model that isn't a complete joke.
Parent