Try native presenters!

There are new archetype versions that make it easy to use the native presenters. What are the native presenters? What is a presenter?

In DukeScript a presenter is a system that makes sure your Java application finds proper HTML rendering environment. By default, when running on desktop, we use and recommend to use JavaFX WebView. However sometimes you don’t want the JavaFX bloat - sometimes you want to render as lightweightly as possible.

With DukeScript webkit presenter, this is possible - on Linux and on Mac OS X. The ability is there for a few months, but now there also is a simple way to achieve that with the archetypes version 0.16. Here are the steps based on our command line tutorial:

$ mvn archetype:generate \
	-DarchetypeGroupId=com.dukescript.archetype \
	-DarchetypeArtifactId=knockout4j-archetype \
	-DarchetypeVersion=0.16 # or newer version
$ cd to_the_just_created_dir
$ mvn install
$ mvn -f client exec:exec

That gives you the classical JavaFX WebView component. The component uses WebKit, but the rendering often suffers from JavaFX bugs. Moreover DukeScript is the “Lightweight JavaFX” - e.g. it doesn’t require all the JavaFX overhead. To see that with your own eyes, try a different presenter:

$ mvn -Pbrowser-presenter -f client exec:exec

See the difference? No JavaFX! This is a real browser (or browser component). The actual view differs on your system and configuration (see the README of the presenter project to find out more). The “browser presenter” just starts local HTTP server and let the browser connect to it. That is highly portable, but not as lightweight as it could be.

However there is more: if you are on Linux or Mac OS X, you can also try the direct WebKit presenter:

$ mvn -Pwebkit-presenter -f client exec:exec

On Mac OS X the presenter shall work out of the box. On Linux you may need to install the WebKit component:

$ sudo apt-get install libwebkitgtk-3.0-0

In any case you can see as lightweight presenters as you can get: no unnecessary libraries (like JavaFX) - just Java and WebKit connected with the smart glue of DukeScript.

You can experiment with these presenters also from the NetBeans IDE. Follow the getting started tutorial and then you can easily invoke the presenters from a popup menu of the client project:

Both “lightweight” presenters are released under GPLv3 license. You can play with them as freely as you want. For commercial usage you may want to contact DukeScript and obtain a license. Enjoy Java and WebKit!