After many months of work and effort put in by all of us but especially by Steve Hannah and Fabrício Carvalho Cabeça we are finally live with the Windows Universal Platform (AKA UWP) native build target!
As far as I know Codename One is the only native option for Java developers to build native Windows UWP apps.
| || Notice that this target is still in technology preview stage! Please report any issue you run into |
Besides the effort of building the Codename One port with everything it entails (including newer build servers) we also leveraged the ambitious iKVM project which we had to modify extensively with the help of some community members specifically Eugene who proved very helpful during this work!
(I hope I didn’t forget anyone, I didn’t take an active role in this port and I might have missed someone if so please accept my apologies).
The whole source of this port as well as our changes to iKVM are available in our git repository.
What does this Mean?
As of May Windows 10 is installed on 300 million PC’s and devices making it a significant platform and appstore. Microsoft has traditionally been quite strong in the enterprise and the ability to sell into that market thru it’s appstore (with the success of the Surface tablet line) is valuable.
Microsoft has standardized on the Universal Windows Platform which effectively "reinvents" Windows as a single platform on all supported devices. In a way this is very much like Java’s Write Once Run Anywhere for the Windows ecosystem (mobile, tablets, xbox, desktops etc.).
Windows UWP apps can be sold thru the Microsoft appstore which is currently growing as users are still adopting Windows 10.
Building an App
You don’t need to make any change to your app to run it on a Windows 10 device/computer. Notice that you will need a certificate file to ship such an app, we are still working on instructions to generate such a certificate in a simple way but you can configure a license file in the new Codename One settings UI under the Windows UWP settings.
| || This is currently optional, you can send a build without configuring a certificate to test this on your local machine |
Figure 1. Open the new Codename One preferences options in the right click of the project
Figure 2. Scroll down using swipe and click the UWP section
Figure 3. You can now set a certficiate file and password for signing a universal app
To actually build the native app you can just right click and select the Windows UWP target, don’t be confused with the two other options for desktop & the old Windows Phone support…
Figure 4. The new Windows UWP target
Installing the build on your machine requires Windows 10 (obviously) but also requires development mode indicating that you can "sideload" applications. We need to writeup our own documentation on how to do this but for now check out this well written guide.
Once you do that your app can run on your machine and we should be able to submit such apps to the Windows store:
Figure 5. Hello world app running on a Windows 10 laptop
The next set of steps depend on you. We will try to get apps into the Windows Store in order to complete the process but we will consider this port production grade only when significant apps start shipping to the Windows Store.
So we need bug reports and demand from you in order to bring this to that coveted production grade status…
Future of Windows Desktop Port
You will also notice, UWP allows building Windows desktop apps which overlaps with the Windows Desktop build target that is currently limited to pro subscribers.
There is still some value in the Windows desktop build in the sense that it’s really a Java SE application with the full power of the JRE behind it. If you need that and compatibility to older versions of Windows this can be quite powerful…
However, if you are interested in a smaller native binary and can live with Windows 10 or newer as the baseline I’d go for the new port as it should provide a superior native experience with a smaller footprint.
For now we will keep supporting the Windows desktop target and have no plans of removing/deprecating it.
| || This section was added on June 14th and was missing from the original post… |
By default debug builds are sent for Windows UWP builds, those default to using x64 architecture only to keep the size small. When you send release builds you will receive a proper universal binary.
To toggle these modes we added two build hints:
uwp.buildType which can be either
debug (the default) or
uwp.platforms which defaults to
x64 on debug builds but can be set to
x64|x86|ARM for universal builds.