Beta

×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

JavaScript JVM Runs Java

timothy posted more than 2 years ago | from the build-a-weirder-mousetrap dept.

Java 234

mikejuk writes "The world of software is made slightly crazy because of the huge flexibility within any computer language. Once you have absorbed the idea of a compiler written in the language it compiles, what else is there left to gawp at? But... a Java Virtual Machine JVM written in JavaScript seems like another level of insanity. A lone coder, Artur Ventura, has implemented a large part of the standard JVM using JavaScript and you can check the code out on Github. Notice this isn't a Java to JavaScript translator but a real JVM that runs byte code. This means it could run any language that compiles to byte code." Bonus: on Ventura's website is a set of visual notes from a talk he gave titled "My Language Is Better Than Yours."

cancel ×

234 comments

Sorry! There are no comments related to the filter you selected.

Happy Holidays from the Golden Girls! (-1)

Anonymous Coward | more than 2 years ago | (#38121450)

Thank you for being a friend
Traveled down the road and back again
Your heart is true, you're a pal and a cosmonaut.

And if you threw a party
Invited everyone you ever knew
You would see the biggest gift would be from me
And the card attached would say, thank you for being a friend.

Re:Happy Holidays from the Golden Girls! (-1)

Anonymous Coward | more than 2 years ago | (#38121628)

s/cosmonaut/confidante

Re:Happy Holidays from the Golden Girls! (-1)

Anonymous Coward | more than 2 years ago | (#38121966)

It's confidant, you idiot.

Javaception (5, Funny)

embolalia (1561119) | more than 2 years ago | (#38121454)

So you could write a browser that supports JavaScript in Java, and then run the browser in itself?

Re:Javaception (5, Informative)

linuxgeek64 (1246964) | more than 2 years ago | (#38121460)

It doesn't implement that much of the standard JVM.

Re:Javaception (1, Insightful)

DrXym (126579) | more than 2 years ago | (#38122112)

It couldn't either. Stuff like threads would be virtually impossible to do on Javascript, even with web workers. I suppose what it might do in the dim and distant future is allow tools like GWT to deploy jar files straight to web sites without any of the usual nonsense of translating Java source into umpteen variations of JS to cope with browser quirks.

Re:Javaception (2, Insightful)

Anonymous Coward | more than 2 years ago | (#38122142)

Not true! Since you're performing the execution of the byte code yourself you could implement the time slicing yourself. It wouldn't be easy sure - but it wouldn't be "virtually impossible". It'd all run within a single thread in the browser but emulating multiple threads in your JVM.

Re:Javaception (4, Funny)

sydneyfong (410107) | more than 2 years ago | (#38122188)

but it wouldn't be "virtually impossible"

Exactly. It'd literally be virtually possible if you control the whole virtual machine...

Re:Javaception (2)

DrXym (126579) | more than 2 years ago | (#38122514)

Well I suppose Java did come from that situation a long time ago - so called "green" threads. So I concede you could probably use some crappy timer / yield type model. The timeslice / yielding would be the issue and all the synchronization / deadlock issues would be fun too.

Re:Javaception (1)

Anonymous Coward | more than 2 years ago | (#38121476)

I hope it supports applets at least. Since applets are rarely supported by the browser itself.

Re:Javaception (4, Funny)

DigiShaman (671371) | more than 2 years ago | (#38121580)

Ouroboros?

Re:Javaception (4, Informative)

cb88 (1410145) | more than 2 years ago | (#38121582)

Sun already did that with HotJava it supported javascript.

Re:Javaception (4, Funny)

afabbro (33948) | more than 2 years ago | (#38121626)

10 Write Browser in Java

20 Write Javascript engine in Browser

30 GOTO 10

Re:Javaception (1)

KarolisP (1538799) | more than 2 years ago | (#38121748)

I have a feeling it would take a bit more lines than that :D

Re:Javaception (4, Funny)

Joce640k (829181) | more than 2 years ago | (#38121920)

Ummmm, Java != Javascript.

I thought that bit of confusion was cleared up by now. I was wrong.

Re:Javaception (1)

Anonymous Coward | more than 2 years ago | (#38121934)

The article is about a JVM that is written i Javascript. Think before posting please.

Re:Javaception (5, Funny)

TheInternetGuy (2006682) | more than 2 years ago | (#38121974)

Think before posting please.

Seriously, if we are going to put that kind of requirement on posters, I will probably have to cancel my slash dot account

Re:Javaception (1)

deniable (76198) | more than 2 years ago | (#38122316)

Geeks: making Marketing's screw-ups reality since the beginning of time.

Re:Javaception (4, Funny)

game kid (805301) | more than 2 years ago | (#38121918)

Now we just have to do all of that in a Minecraft map so the CPU collapses under its own virtual weight!

Re:Javaception (1)

Robert Zenz (1680268) | more than 2 years ago | (#38122120)

You mean a Mincraft map with Redstone-circuitry building a 32-bit processor + OS + Browser + JavaScript + BicaVM running Minecraft with that map? Uhh...I feel dizzy...

Re:Javaception (5, Interesting)

alexhs (877055) | more than 2 years ago | (#38122190)

So you could [...] run the browser in itself?

Old news. Try chrome://browser/content/browser.xul [chrome] in Firefox (doesn't seem to work as a clickable link, though).
See here [mozillazine.org] for more options.

Re:Javaception (4, Funny)

StripedCow (776465) | more than 2 years ago | (#38122452)

This is modded "funny", but actually this would be very useful. Because you could send the browser along with your HTML and be done at once with all browser-compatibility problems. Plus you could make browsers supporting other languages (e.g., Python, Haskell, you name it).

Of course javascript would not be the appropriate target-language for this (I guess, due to efficiency issues), but the idea in itself is very interesting. A better target-language would be closer to the machine (no closures, and no garbage collection); the NaCl project might actually be a better candidate. [google.com]

I'm betting that somewhere, somebody is already writing a browser in NaCl.

Re:Javaception (1)

Lennie (16154) | more than 2 years ago | (#38122534)

I think a large performance gap will be fixed when JavaScript engines support type inference. JavaScript is dynamically typed, which is slower. But if the engine can figure out what type a variable is, it can optimize for that and be just as fast as typed lnaguage JIT VM:

http://blog.mozilla.com/futurereleases/2011/11/10/type-inference-to-firefox-beta/ [mozilla.com]

First I was like D: .... (0)

Anonymous Coward | more than 2 years ago | (#38121492)

then I was like :D

Sounds lame for about 2 seconds, then it hits you... run software in a browser with no plugins (albeit at a very low rate of speed...)

Re:First I was like D: .... (1)

Joce640k (829181) | more than 2 years ago | (#38121922)

If it means not having the Java runtime installed on my machine then I see no downsides to it.

Re:First I was like D: .... (1)

deniable (76198) | more than 2 years ago | (#38122336)

Microsoft JScript JVM anyone? I can see 'tweaks' to this JVM happening a lot. Then it's write once, test everywhere you can find, pray. Anything web guys can mess with...

Anything which can be written in JavaScript ... (5, Funny)

Musically_ut (1054312) | more than 2 years ago | (#38121500)

... will be eventually written in JavaScript. ~ Atwood's Law [codinghorror.com] (circa 2007)

Not A New Concept (3, Interesting)

DERoss (1919496) | more than 2 years ago | (#38121528)

Forty years ago, a major software system for operating unmanned space satellites for the U.S. Air Force was written in a language called JOVIAL J4. The JOVIAL J4 compiler was itself written in JOVIAL J4.

Originally intended for a lifetime of 10-15 years, the system was actually in use for 20 years.

Re:Not A New Concept (5, Interesting)

bucky0 (229117) | more than 2 years ago | (#38121568)

I feel like that sort of bootstrapping is normal. GCC's written in C, afterall.

Re:Not A New Concept (3, Informative)

afabbro (33948) | more than 2 years ago | (#38121622)

Forty years ago, a major software system for operating unmanned space satellites for the U.S. Air Force was written in a language called JOVIAL J4. The JOVIAL J4 compiler was itself written in JOVIAL J4.

Hardly unusual. GCC is written in C.

This is not quite the same thing.

Re:Not A New Concept (1)

Joce640k (829181) | more than 2 years ago | (#38121928)

Nothing unusual about that...most C compilers are written in C and the first C++ compiler was written in ... C++.

Re:Not A New Concept (4, Informative)

TheRaven64 (641858) | more than 2 years ago | (#38122432)

Most compilers work like that. The Java compiler is written in Java (as you discover when it crashes and you get a Java stack trace). Smalltalk was written in Smalltalk and even modern Smalltalk implementations like Pharo are written in Smalltalk. The typical trick is to write a small compiler for a subset of the language in another language and then use it to compile the rest of the compiler. For example, the core of the Squeak VM is written in a subset of Smalltalk that is fairly easy to translate to C. This is then translated to C and compiled with the target system's C compiler. You then have enough of the VM running for it to load the rest. Early Pascal compilers did the same. In the '70s, having the compiler written in the language was considered a test of whether something was a 'real' language (since then we've learned that languages that are good for writing compilers are not necessarily good for other things. Well, some of us have...)

yo dawg (4, Funny)

Anonymous Coward | more than 2 years ago | (#38121544)

So we heard you like java...

Hey Bro... (4, Funny)

bennomatic (691188) | more than 2 years ago | (#38121548)

...I heard you like Java in your script so I wrote you a JVM in Javascript so you can run Java while you're scripting.

Joking aside, this is not going to help the amount of confusion people have with regards to Java not being the same as Javascript *at all*.

Re:Hey Bro... (5, Funny)

Mitchell314 (1576581) | more than 2 years ago | (#38121590)

Of course there's a difference. Java is defined as the language that runs on top of javascript. This is simple, it's just a compiled language that runs atop of an . . . interpreted . . . of an interpreted . . . it's a compiled . . . it's a compiled language that runs on an interpreted . . . okay guys, really, what the fuck? I think I just heard the sound of part of the universe and a good chunk of logic spontaneously imploding. I'm going to go cry now, and thanks to these dipshits my tears will probably fall sideways upwards now.

Re:Hey Bro... (0)

Anonymous Coward | more than 2 years ago | (#38121714)

A language is just a language. The interpreted/compiled descriptor just says how it is normally used.

Re:Hey Bro... (0)

Anonymous Coward | more than 2 years ago | (#38121950)

Calling Java a compiled language is quite a stretch. The java compiler just compiles to bytecode in a completely unoptimized fashion that reduces some small overheads the Java Virtual Machine (in other words: an interpreter) would otherwise have. So what he's really doing is running a bytecode interpreter in an interpreted language.

Re:Hey Bro... (2)

PCM2 (4486) | more than 2 years ago | (#38121990)

Hey, 1996 calling. Does our interpretation of how Java works still fit? Because if you're not using it anymore, we'd like it back.

Re:Hey Bro... (1)

DrXym (126579) | more than 2 years ago | (#38122166)

It is a compiled language. It's compiled into bytecode. Whether it's optimized or not is a function of the compiler implementation. It's true the default compiler doesn't do much optimization,but that doesn't mean it is not possible. The Eclipse compiler and Jikes have some optimization settings and you always run a file through proguard too.

Re:Hey Bro... (1)

deniable (76198) | more than 2 years ago | (#38122354)

They're working on JIT compilers though. Not sure when they'll be ready. It will allow the local machine to optimize the byte-code for local conditions.

Re:Hey Bro... (2)

TheRaven64 (641858) | more than 2 years ago | (#38122480)

What is this, 1998 appreciation day? They were working on JIT compilers for the first release of Java! Modern JVMs all use JIT compilation extensively. The only ones that don't are ones designed to run on very small embedded systems, which use Jazelle, which is basically a Java bytecode decoder on the front of an ARM chip that executes most bytecodes directly and traps on the difficult ones.

Re:Hey Bro... (1)

deniable (76198) | more than 2 years ago | (#38122358)

Just run it inside VMWare or Virtual PC and you won't have any problems.

Re:Hey Bro... (1)

Anonymous Coward | more than 2 years ago | (#38121598)

Those who care know there is a difference, those who don't ask for a mug...

This is nonsense. (-1, Troll)

scottbomb (1290580) | more than 2 years ago | (#38121594)

Javascript != Java. "Javascript" is just a naming rip-off. So what's the big deal?

The C# compiler was written in C++. Again, two different animals.

Re:This is nonsense. (4, Insightful)

afabbro (33948) | more than 2 years ago | (#38121616)

Javascript != Java. "Javascript" is just a naming rip-off. So what's the big deal?

It's like writing a C compiler in Bourne shell. The point is less about the name than about the complexity and absurdity.

Re:This is nonsense. (0)

Anonymous Coward | more than 2 years ago | (#38121792)

Umm... seriously, comparing JS to the Bourne Shell is a bit unfair.

Re:This is nonsense. (1)

Anonymous Coward | more than 2 years ago | (#38122042)

To the bourne shell

Re:This is nonsense. (3, Funny)

Adrian Harvey (6578) | more than 2 years ago | (#38122174)

It's like writing a C compiler in Bourne shell. The point is less about the name than about the complexity and absurdity.

Isn't it more like writing a C compiler in C-shell - at least name-wise :-)

Re:This is nonsense. (4, Funny)

deniable (76198) | more than 2 years ago | (#38122364)

More like writing a Python interpreter in Perl. It'll work, but you'll feel a little dirty afterwards.

Re:This is nonsense. (2)

Arancaytar (966377) | more than 2 years ago | (#38121652)

Names have nothing to do with it. They could have just as well written their JVM in Python, Perl or PHP - except that none of those languages have undergone ten years of browser vendors fighting head to head to shave off another few microseconds on benchmarks, so their interpreters would be too slow to run an effective virtual machine.

Re:This is nonsense. (1)

mcavic (2007672) | more than 2 years ago | (#38121728)

I'd love to see it done in PHP. Anything to avoid running a Tomcat installation would be useful.

Re:This is nonsense. (2)

HJED (1304957) | more than 2 years ago | (#38121838)

JVM is a run time environment not a compiler (although the environment includes a JIT compiler).
Also I think the point was javascript is seen as a less powerful language

Re:This is nonsense. (2)

Shoe Puppet (1557239) | more than 2 years ago | (#38122026)

I can see a use case: Once we have a mostly complete JVM interpreter with satisfactory performance written in Javascript, we can use any language that supports the JVM instead of Javascript.

DOM-Interface for byte code (5, Interesting)

maweki (999634) | more than 2 years ago | (#38121602)

For years I've been saying that we need a DOM-Interface for byte code in Browsers and everytime I get downvoted. Nice to see people exploring in these directions now.

"we do need DOM-Bindings for Bytecode now more than ever. It would be so great to write code in a language of my choice and compile it to Browser-Bytecode with DOM-Bindings. This would make it possible to deliver more proprietary code without making browser-plugins or something similar."

"What we really need are DOM-Bindings for Bytecode. So you can use every language you want that is capable of compiling to bytecode and send it to a browser. This would make it easier for the developer and bytecode is easier and faster for the browser to execute."

Re:DOM-Interface for byte code (1)

Anonymous Coward | more than 2 years ago | (#38121876)

Even sandboxed in a VM, I'd be inherently wary about executing server-compiled byte-code. Isn't this why we got rid of Flash?

Re:DOM-Interface for byte code (1)

xororand (860319) | more than 2 years ago | (#38121894)

more proprietary code

How is this progress? Why would we want to go backwards?
If anything, we need less proprietary code on the web.

We should have learned from the consequences of lock-in by now. See: Flash, Java applets, ActiveX.

Re:DOM-Interface for byte code (4, Insightful)

devent (1627873) | more than 2 years ago | (#38121906)

Yes, would make sense, wouldn't it? Instead that every browser have to interpret the slow JS language (yes, JS language is slow to interpret, because of the design choices. Just watch some of Doug Crockford videos), we could all just agree on a byte code standard like the Java byte code standard.

Then you could develop web applications in your choice of language and not just in JS. On the server you upload just the byte code, like the compiled Java source code (.class).

For example, you could develop in Ruby, Python or Java, and compile the code to the byte code for browsers. Then you deploy the byte code on the server.

But the web-developers are so stubborn with their JS language, I don't know why.

Re:DOM-Interface for byte code (2)

jimicus (737525) | more than 2 years ago | (#38122266)

Of course we had that with Java applets a few years ago - they didn't really take off.

A number of reasons for this exist: first is there were a couple of implementations of the JVM and they weren't all compatible with each other. Second is that the same version of the same JVM (Sun's at the time) exhibited subtly different behaviour on different platforms - meaning it was fantastically easy to wind up with something that only worked well on one or two platforms. ISTR font handling in the UI was a big killer - there were a few ways to do it and unless you did it a particular way, you wound up with an applet where the widget text was only readable on Windows.

Re:DOM-Interface for byte code (1)

the entropy (1331573) | more than 2 years ago | (#38122388)

Yes, but what is different about what the first poster in this thread was suggesting is for that bytecode to have DOM bindings. Java applets were self-contained applications that ran in a window within the page and touched nothing outside of that(and had to do all the drawing themselves and were completely inconsistent with the rest of the page with regards to look and feel as a result).

What is being suggested here is something that would replace javascript that would interact with and modify the whole page through a DOM interface, completely unlike an applet and much more useful.

Re:DOM-Interface for byte code (1)

jimicus (737525) | more than 2 years ago | (#38122394)

Ah, I hadn't fully registered that.

You're quite right - but then you immediately start to run into sandboxing & security issues.

Re:DOM-Interface for byte code (4, Interesting)

martin-boundary (547041) | more than 2 years ago | (#38121926)

I'd rather have source code than byte code. The web was built on visible code like HTML. Do you think it would have exploded if people couldn't look at the source to figure out how some neat web page was written?

Re:DOM-Interface for byte code (2)

devent (1627873) | more than 2 years ago | (#38122184)

What have that do to with your argument? Libraries like JQuery will still be open source.
I would rather think that Web exploded because it's build on open technologies and open source software.
And if the Byte Code is a standard, it's as simple as a editor or disassembler to use to see the code.
Also, I don't think you can read that code: http://code.jquery.com/jquery-1.7.min.js [jquery.com]

Re:DOM-Interface for byte code (1)

Anonymous Coward | more than 2 years ago | (#38122258)

Um, so? (sincere question, not being a prick.)

The web already exploded. We're now well past that DIY point.

Yes, sure some enthusiasts still code their own, but we're way past where knowing some HTML was how you got a site up. Individuals have long moved to templates - blogs, wordpress, facebook, tweets and whatever.

Browser incompatibility successfully killed the original DIY plan. I'm nostalgic and sentimental about it, but it's gone. Coding is a pro game now. So why not byte code?

Re:DOM-Interface for byte code (3, Interesting)

the entropy (1331573) | more than 2 years ago | (#38122396)

How is what we have now with things like minified js any different than bytecode? Have a look at the source for gmail, or the minified version of jquery. You need analysis software to have any hope of making any sense of it and it's exactly the same then as a bytecode decompiler.

jQuery is open source, which means you can get the non-minified version and read that to know how it works, but I would dare anyone to make sense of the 100s of KBs of obfuscated js that is the gmail interface(or quite a few other popular products and services for that matter).

Re:DOM-Interface for byte code (1)

hpoul (219387) | more than 2 years ago | (#38121978)

well, somehow google thinks javascript IS bytecode :) they compile java to javascript (GWT) and (until it's supported in any browser) their own language http://www.dartlang.org/ [dartlang.org] (dartc) .. so the missing part is not the browser-bytecode.. simply write your compiler to output javascript instead of bytecode ;)

Re:DOM-Interface for byte code (0)

Anonymous Coward | more than 2 years ago | (#38122180)

You get downvoted because running remote bytecode in web browsers is a stupid idea. There's nothing stopping you writing the interpreter in javascript if you wish -- knock yourself out!

Re:DOM-Interface for byte code (1)

chrism238 (657741) | more than 2 years ago | (#38122324)

"For years I've been saying that we need a DOM-Interface for byte code in Browsers and everytime I get downvoted. Nice to see people exploring in these directions now." You're not Andrew Tanenbaum by any chance, are you?

Re:DOM-Interface for byte code (1)

Bomazi (1875554) | more than 2 years ago | (#38122338)

It is not 100% working yet but it already exists. There are standard java bindings [w3.org] for the DOM. As an example, rhinohide [zelea.com] allows java applets to access the DOM via the standard bindings thanks to a javascript bridge. In this demo [zelea.com] , which should work in firefox, a java applet modifies the document it is embedded in via this mechanism.

Interesting mind set (3, Insightful)

sgt scrub (869860) | more than 2 years ago | (#38121632)

The motivation for this effort is put very well in Artur's blog. He argues that rather than build JavaScript into web browsers they should have a virtual machine so that any language can be used. As well as this advantage, he also points out that with a JVM type approach you get automatic sandboxing and simply sending the JVM to the server provides browser independent persistence.

I think it would have been easier to build a VM into a browser but I doubt it would have gotten this much attention. Still. It is a cool project.

Java Applets (1)

future assassin (639396) | more than 2 years ago | (#38121634)

created by Java which was created with Java-script. Have the planets aligned?

Canada Goose (-1)

Anonymous Coward | more than 2 years ago | (#38121654)

Canada Goose [canadagoos...ts-sale.ca]
Canada Goose Sale [canadagoos...ts-sale.ca]
Canada Goose Outlet [canadagoos...ts-sale.ca]
Canada Goose Jackets [canadagoos...ts-sale.ca]
Canada Goose Jacket [canadagoos...ts-sale.ca]
Canada Goose Parka [canadagoos...ts-sale.ca]
Canada Goose Coats [canadagoos...ts-sale.ca]
Canada Goose Chilliwack [canadagoos...ts-sale.ca]

Parka
Canada Goose Expedition [canadagoos...ts-sale.ca]

Parka
Canada Goose Snow Mantra [canadagoos...ts-sale.ca]

Parka
Canada Goose Solaris Parka [canadagoos...ts-sale.ca]
Canada Goose Trillium [canadagoos...ts-sale.ca]

Problem is speed (2, Interesting)

Anonymous Coward | more than 2 years ago | (#38121706)

I doubt that Javascript accelerators are good at optimizing this, but it's not fundamentally impossible to run it close to JVM speeds. JS is a language that in nutshell is self modifying code, so it can act as a translational layer which in the end enables running Java in a Javascript engine (interpreter,VM or whatever). It could be compared to Dart which also runs another type of language in JS.

Re:Problem is speed (1)

Lennie (16154) | more than 2 years ago | (#38122518)

I think it will be (a lot better) when they've added this important part:

"Type Inference brings JS improvements to Firefox Beta"

"Javascript is a dynamically typed language, and without knowing the types of values a JIT compiler needs to generate code that accounts for all the possible types of the involved values. This significantly slows down execution of the program in comparison with a statically typed language like Java. With TI integration into JaegerMonkey, we are closing a significant part of this performance gap. Ongoing Mozilla projects are being built to leverage inferred type information. With these projects, primarily IonMonkey, Mozilla’s next generation JIT compiler, we hope to close the performance gap with Java completely."

http://blog.mozilla.com/futurereleases/2011/11/10/type-inference-to-firefox-beta/ [mozilla.com]

Yo dawg.. I heard you like Java, so (1, Funny)

D,Petkow (793457) | more than 2 years ago | (#38121722)

{yo,sup} dawg, I heard you like Java, so I put an Java Virtual Machine on top of your your Java, so you can compile Javascript while running the JVM.

Re:Yo dawg.. I heard you like Java, so (1)

Anonymous Coward | more than 2 years ago | (#38121744)

Yo dawg, I heard you liked recursion, so I ran a JVM inside the Rhino Javascript Engine on the JVM.

Re:Yo dawg.. I heard you like Java, so (1)

Robert Zenz (1680268) | more than 2 years ago | (#38122126)

Yo dawg, I heard you got Java and JavaScript swapped!

Yo dawg, (0)

boxxertrumps (1124859) | more than 2 years ago | (#38121758)

I wrote a runtime in a scripting language so you can code while you script and I can debug while I debug.

Yo dawg, I heard you like bloat (4, Funny)

wye43 (769759) | more than 2 years ago | (#38121820)

... so I've put bloat in bloat, so you can wait while you wait.

Really? (5, Informative)

aglider (2435074) | more than 2 years ago | (#38121826)

This

This means it could run any language that compiles to byte code.

shoud read as
  This means it could run any language that compiles to Java byte code.

Re:Really? (2)

dkf (304284) | more than 2 years ago | (#38122100)

This

This means it could run any language that compiles to byte code.

shoud read as

  This means it could run any language that compiles to Java byte code.

Technically, it's running anything that compiles to JVM bytecode. There are a number of languages that do that, one of which happens to be Java. (Yes, JVM stands for Java Virtual Machine and it would indeed be odd if Java didn't compile to it, but Java isn't JVM bytecode, just as C isn't native machine code.)

Re:Really? (1)

CodeReign (2426810) | more than 2 years ago | (#38122102)

As someone who regularly programs in Java and is slowly branching out, I haven't used other JVM languages, are their bytecode primarily the same with optimization to the language or is it entirely different byte code all together for another JVM language.

sort of already done? (1)

Anonymous Coward | more than 2 years ago | (#38121842)

Sun already made a JVM written in Java, so it can run java. see Maxine [wikipedia.org]

Not mind blowing when ... (3, Insightful)

fsckmnky (2505008) | more than 2 years ago | (#38121880)

... you understand that a computer language, is a mapping of human readable symbols -> cpu instructions, either direct or indirect. If the mapping results in a set of cpu instructions that implements another language, you get another language.

It's not rocket science people, its just math. Wait, maybe it is rocket science.

Re:Not mind blowing when ... (0)

Anonymous Coward | more than 2 years ago | (#38121908)

maths r hard

Re:Not mind blowing when ... (1)

MLease (652529) | more than 2 years ago | (#38121986)

Let's go shopping!

This thing runs on the iPad? (0, Flamebait)

lord_mike (567148) | more than 2 years ago | (#38121888)

What's that I hear? Steve jobs spinning in his grave? He can't be happy looking down at his consumers and them having some choices in what they want to run on "his" hardware. Oh well...

This is completely unnecessary. (5, Funny)

DamnStupidElf (649844) | more than 2 years ago | (#38121954)

Fabrice Ballard already wrote an x86 emulator [bellard.org] in javascript. Just install the standard x86 JVM inside of that and you're good to go.

Re:This is completely unnecessary. (4, Funny)

jenic (1231704) | more than 2 years ago | (#38121994)

Fabrice Ballard already wrote an x86 emulator [bellard.org] in javascript. Just install the standard x86 JVM inside of that and you're good to go.

Yes, that's why this is completely unnecessary.

Re:This is completely unnecessary. (3, Informative)

Anonymous Coward | more than 2 years ago | (#38122368)

Dammit, Fabrice Bellard keeps making me feel like I am as dumb as a plate of chicken.

it will be useful for ... (1)

georgesdev (1987622) | more than 2 years ago | (#38122014)

... justifying tera-hertz processors!

Why now? (4, Interesting)

thegarbz (1787294) | more than 2 years ago | (#38122156)

Legit question from a programming novice: Why are all these discoveries coming up now? Hasn't JavaScript been around for 10+ years now? Is there something that has changed recently that makes people pursue these strange coding goals?

Re:Why now? (4, Informative)

sydneyfong (410107) | more than 2 years ago | (#38122208)

Javascript speeds have increased greatly due to the reheated competition by browser vendors (it wasn't too long ago that the only thing really existed was IE6). Thus in the past 10 years, nobody in their right mind would expect a x86 emulator, a JVM etc. to be implementable in Javascript at tolerable speed.

In fact, few expect these "discoveries" to happen so soon and so quickly, but since somebody proved it possible to do crazy things on Javascript, everyone with too much time on their hands are jumping on board and having fun with these projects.

Re:Why now? (1)

fsckmnky (2505008) | more than 2 years ago | (#38122214)

It's only a discovery if you're an over-enthusiastic n00b at this game.

To the rest of us, its same-old-shit-different-day.

Re:Why now? (0)

Anonymous Coward | more than 2 years ago | (#38122220)

I think in large part one needed a generation to grow up with it. There was too much unjustified hate for it at a certain point in time. People growing up with js as an environment that was free to get started with, had tons of support, and was crossplatform changed a lot of things. Both for themselves, and for people who'd dismissed it early on without watching the changes over the years.

Re:Why now? (1)

jimicus (737525) | more than 2 years ago | (#38122304)

It's not a discovery by any stretch. (And JavaScript has been around a bit more than 10 years, I wrote a fairly basic game in an unholy mishmash of JavaScript and HTML circa 1998-1999).

Provided JavaScript is Turing-complete (and there are very few useful languages that aren't), basic computing theory teaches us that it's possible to write more-or-less anything you want in it.

Note the keyword here is possible. Desirable and practical are totally different matters altogether.

This guy needs to see a psychiatrist. (0)

Anonymous Coward | more than 2 years ago | (#38122198)

What a gigantic waste of time.

LOL awesome.. (1)

holyshitagain (2513100) | more than 2 years ago | (#38122202)

But not surprise, since javaScript can implement a Y combinator (a Y-combinator is a function that operates other functions to enables recursion when it can't refer to itself from within itself.)

Cute hack (1)

j1976 (618621) | more than 2 years ago | (#38122348)

Ok, that's about the most amusing hack since someone wrote a fully working web server in postscript: http://www.pugo.org:8080/ [pugo.org]

(Still think the postscript web server leads the list of odd hacks)

Redundant acronym is redundant (1)

Anonymous Coward | more than 2 years ago | (#38122350)

"a Java Virtual Machine JVM written in JavaScript"

A Java Virtual Machine Java Virtual Machine written in JavaScript..... really?

A JVM JVM written in JS?

Right, I need to go and try to rememeber by Personal Identification PIN Number so that I can use the Automated Teller ATM Machine.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?
or Connect with...

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>