From APIDesign
(→C'mon: That is not my Browser!) |
|||
Line 24: | Line 24: | ||
and you'll see the same application running in your default system browser. | and you'll see the same application running in your default system browser. | ||
+ | |||
+ | == Single [[API]] - Dual (or more) Deployment == | ||
+ | |||
+ | How can the same code run in [[HotSpot]] as well as [[Bck2Brwsr]] [[VM]]s? Is the [[Bck2Brwsr]] [[VM]] so good? Does it really mimic the standard [[Java]] [[VM]] that closely? | ||
+ | |||
+ | Well, it does not. There are differences in [[Java]] to [[JavaScript]] calling conventions (see [[Bck2BrwsrMangling]]) as well as in the way one executes [[JavaScript]] bindings in [[JavaFX]]'s WebView and real browser. As such the compatibility between the two modes is achieved by having single [[ClientAPI]] and multiple its [[ProviderAPI|implementations]]. See [[JSON4Brwsr]] page for details. | ||
+ | |||
+ | [[Category:Bck2Brwsr]] |
Revision as of 08:41, 30 April 2013
Follow me at @JaroslavTulach. In case you are interested in Bck2Brwsr project, read on.
Twitter Client Demo
The aim of Bck2Brwsr is to bring Java back to browsers. To demonstrate that it is possible, there is an online Twitter client demo. Visit Twttr Client to see Java running in your plugin-less (e.g. no need to hava Java installed) browser.
In case you are curious how the above has been achieved and you are willing to spend few more minutes with the project, here are steps to get the Java to your browser as well:
$ hg clone https://hg.java.net/hg/html~demo $ cd html~demo/twitter/ $ mvn install bck2brwsr:brwsr
If everything goes well you should see JavaFX's WebView component (if you have JDK7 with JavaFX) showing tweets from famous tweeters (if your JDK knows how to pass through your HTTP proxy).
C'mon: That is not my Browser!
If you got that far, you may properly object that the above is far from bringing Java Bck2Brwsr. You'd be right! The above mode is called FXBrwsr (and it is useful as well, for example for debugging). However the real beauty (and major achievement of release 0.7 of the Bck2Brwsr project) is that the same code can easily be re-packaged and executed in the browser. Just type:
$ mvn -Pbck2brwsr install bck2brwsr:brwsr
and you'll see the same application running in your default system browser.
Single API - Dual (or more) Deployment
How can the same code run in HotSpot as well as Bck2Brwsr VMs? Is the Bck2Brwsr VM so good? Does it really mimic the standard Java VM that closely?
Well, it does not. There are differences in Java to JavaScript calling conventions (see Bck2BrwsrMangling) as well as in the way one executes JavaScript bindings in JavaFX's WebView and real browser. As such the compatibility between the two modes is achieved by having single ClientAPI and multiple its implementations. See JSON4Brwsr page for details.