Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Google's "Dart" on the JVM

DZone's Guide to

Google's "Dart" on the JVM

· Java Zone
Free Resource

Managing a MongoDB deployment? Take a load off and live migrate to MongoDB Atlas, the official automated service, with little to no downtime.

Google's newest programming language can now be run on the JVM, thanks to the JDart project hosted on Google Code. Unveiled at the goto conference last week, the Dart language is seen by some to be suitable for Java developers who can't get into Javascript. The language is supposed to make it easy to create quick prototypes using structured code. Visual Basic for the web? We'll see. 

The JDart project is in it's early stages, with only a few instructions translated. The JDart compiler generates jar files to run on any Java 7 VM. The author has provided a few examples so you can see what the compiler actually generates. Here's the simple Hello World output. First the Dart code: 

main() {
  print("hello world");
}

Which gets compiled to the following:

public class test {
  public static void main(java.lang.String[]);
    Code:
       0: invokedynamic #18,  0             // InvokeDynamic #0:__main__:()V
       5: return        

  public static java.lang.Object __main__();
    Code:
       0: ldc           #21                 // String hello world
       2: invokedynamic #27,  0             // InvokeDynamic #1:print:(Ljava/lang/String;)V
       7: aconst_null   
       8: areturn       
}

It's very early days for Dart, and it has a long way to go if it has any chance of toppling Javascript. But if you've been messing around with the languages, perhaps this project gives you another reason to consider moving to it for your web applications. 

 

 

MongoDB Atlas is the easiest way to run the fastest-growing database for modern applications — no installation, setup, or configuration required. Easily live migrate an existing workload or start with 512MB of storage for free.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}