Open Source & Free  

Tutorial – Desktop and JavaScript Ports

Tutorial – Desktop and JavaScript Ports

Header Image

Codename One has ports for Mac, Windows & even for the browser. These are often confused and the introduction of the UWP port which also includes some overlap only made matters worse. Each one of these ports covers a segment that the other ports don’t.

In this tutorial I try to separate the various ports & explain when each one of them should be used. I also dispel common misconceptions about these ports.


  • Francesco Galgani says:

    Where are some working examples of the javascript port of some apps?

    Please also note the the link “Developer guide section covering the JavaScript port” in the page “How Do I – Use the Desktop and JavaScript Ports” is broken (the word “manual” in the URL is duplicated).

  • Shai Almog says:

    Thanks! We’ll fix the links.
    You can look at the demos in the demo section. Each one of them has a JavaScript link among the links in the bottom.

  • Francesco Galgani says:

    I’m thinking to upgrade my account to Enterprise because I really interested in the javascript port. My idea is to develop from scratch an app for smartphone and tablet and a web site using the same code: is it possible? Your demos have some problems…

    In my opinion, the user experience needs to be improved, because the user expects to have an hand cursor on clickable elements, but this doesn’t happen. Is it possible?

    Please note that the PropertyCross demo doesn’t work properly: open the js port and on search write “London”, and then click on Go. You will have a “Searching…” form with an infinitive loop, but nothing more, no results (tested on Chrome and Firefox on Linux and Windows). More over, the Poker demo js port doesn’t work at all: try to open it, you will get a white page (tested on Chrome and Firefox on Linux).

    I didn’t tested all the demos, maybe they need a check. At the moment my first impression is not the best, but I hope that all the problems are resolvable.

  • Shai Almog says:

    We support cursor behavior in the current version of Codename One (I think it was added for 3.7) but we don’t implicitly change the mouse cursor. This should work on JavaScript and in the simulator see […](

    I just tried the pocker demo and it worked for me, it took a few seconds to load so maybe some hiccup happened during download on your end?

    Property cross seems to freeze when accessing the network, we might have an issue in our webserver as we need to proxy server calls to workaround the “same origin” restriction. We’ll have to look into that.

  • Francesco Galgani says:

    Thank you for the Mouse Cursor tip.

    I cannot open the Poker demo on my computer, I tried different browsers.
    This is the console output of the Poker demo (js port) on my updated version of Google Chrome:

    fontmetrics.js:69 [Deprecation] ‘window.webkitStorageInfo’ is deprecated. Please use ‘navigator.webkitTemporaryStorage’ or ‘navigator.webkitPersistentStorage’ instead.
    (anonymous) @ fontmetrics.js:69
    (index):1 Uncaught (in promise) DOMException: The requested version (1) is less than the existing version (2).
    []( Uncaught (in promise) TypeError: Cannot read property ‘J9’ of null
    at C ([](
    at $rt_ustr (classes.js:4)
    at ThB (classes.js:4666)
    at PJ ([](
    at JEB ([](
    at Y0 ([](
    at Gy ([](
    at BeB ([](
    at YRC ([](
    at Nj ([](

  • Shai Almog says:

    Thanks for the headsup. I think there might have been a change in chrome that we already adapted the code to but didn’t refresh this demo (I use firefox and it works on it). I just sent a new build and it works, we’ll update the demo a bit later but you can check out a live preview here: [https://codename-one.appspo…](

    Notice that like all Codename One build links this will expire in a couple of days.

  • Francesco Galgani says:

    Very good news: the live preview you linked works correctly 🙂

Leave a Reply