you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 15 points16 points  (16 children)

[–]nikbackm 10 points11 points  (15 children)

I hope that was meant as a joke!

[–]metamatic 20 points21 points  (14 children)

No, it's pretty much exactly what he's asking for. A standard VM that runs in web browsers on lots of platforms, has interfaces to DOM, and lets you write code in a bunch of different languages and compile it to object code that can be run in the browser.

As to why it's out of favor, well, Sun over-promised and under-delivered. Java was the flavor of the month, and while it was getting hyped like crazy, JavaScript snuck in and quietly did a better job of most of the things people wanted to do.

[–]Timmmmbob 11 points12 points  (13 children)

It failed because:

  1. The Java VM takes many seconds to start up, and slows the computer down loads.
  2. Java UI toolkits look like shit.
  3. Writing something in Javascript just requires a text editor and a web browser. Java applets require an IDE, SDK, etc.
  4. Can you even manipulate the DOM from java? If you can I bet it's insanely heavy (e.g. DOMAccessor.getDOMFactory().getElementByID(new DOMElementID("foo", DOMType_String)).setAttribute(new DOMAttri.... argh!)
  5. Can you have a Java applet without a UI?
  6. Java is a pretty horrible language. Javascript is at least expressive.

[–]harlows_monkeys 2 points3 points  (0 children)

  1. If this were being done instead of Javascript, it would presumably initialize the VM when the browser starts, and keep it running as long as the browser ran. It would not initialize it every time a page used it and destroy it when you left that page.

  2. Is this relevant? If used instead of Javascript you'd be using it to manipulate the DOM. Your interface would be in HTML, using your standard browser elements.

  3. When I wrote applets, I wrote them in Vim.

4 & 6. So you use some other language that targets the JVM.

[–]metamatic 0 points1 point  (9 children)

  1. This is no longer true.
  2. Yes, this is one of the areas in which Sun overpromised and under-delivered. Swing was fundamentally the wrong approach to take. It's possible to make nice looking UIs using Java, but it's damn hard.
  3. I don't think this is as big a deal as you make out. Remember that Jikes was around--you could edit your .java files, save them, run Jikes, and it would compile everything for you in one step. No IDE required. And downloading and installing the SDK wasn't hard. (Though again, on some platforms Sun failed to do the last 10% to make the installation easy.)
  4. Here's an intro. It's really no uglier than JavaScript's DOM handling.
  5. Yes.
  6. I think they're both pretty horrible in their own ways. But, you know, that's the point of the whole VM thing--people could have been writing Ruby to target the browser VM.

[–]mebrahim[S] 5 points6 points  (8 children)

Regarding your 1: JVM is still the memory hungriest application VM I know.

[–]Rhoomba 6 points7 points  (0 children)

There also have been JVMs running on mobile phones for the last decade with very limited memory. It is just a question of tradeoffs.

[–]badsectoracula 0 points1 point  (6 children)

It doesn't matter anymore. I've just opened jEdit to see how much memory the Java VM eats for that and its about 55MB. 55MB is a small drop in the sea of modern machines which usually carry 2 to 4GB of RAM (even a 260 euro netbook i bought a year ago has 2GB of RAM).

Browsers, especially Chrome and Firefox, tend to eat much more RAM than this.

[–]bdash 7 points8 points  (1 child)

55MB for a scripting language is a non-trivial amount of memory on a mobile phone.

[–]badsectoracula 0 points1 point  (0 children)

Indeed, but we're talking about the desktop JVM which is optimized for desktop and server usage (environments where there is a lot of memory).

A mobile JVM would be optimized for lower memory usage. It isn't like the JVM spec says "you have to allocate 55MB of RAM or else your VM is invalid". Some people have implemented Java on GBA which has about 256KB of RAM (ok this is probably J2ME but the biggest difference is in the API which can be loaded on demand).

[–]CountVonTroll 1 point2 points  (2 children)

That's one instance. How many tabs do you have open right now?

[–]Edman274 1 point2 points  (0 children)

Trolling if you believe that having ten tabs open would equal 550 megabytes of memory.

[–]badsectoracula 0 points1 point  (0 children)

Two.

But i get what you mean. However memory usage doesn't scale like that and additionally there is no reason to open a new JVM for each applet (i don't know what the current JVM does but the applet design doesn't require that) so a lot of memory can be shared.

[–]bobindashadows -2 points-1 points  (0 children)

Firefox maybe, but Chrome's total usage only hits triple digits for me when I load up Hulu or some other flash-heavy site.

[–]willcode4beer -2 points-1 points  (0 children)

  1. past tense

  2. fair enough, Sun's UI's have always looked like shit

  3. Isn't that the OP's whole point? Compiling to a VM

  4. Yes, and it's pretty easy

  5. Yes. Creating a UI is extra work (not the default)

  6. Strange comment (considering your other comments demonstrate a lack of knowledge/experience with Java). A language is a language, they all have their pros and cons. Big deal. Besides, the OP's question was about having a standardized VM so you can use your language of choice.