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

Java Developers Can FINALLY Target Windows UWP

DZone's Guide to

Java Developers Can FINALLY Target Windows UWP

Since Microsoft has standardized on the Universal Windows Platform which effectively "reinvents" Windows as a single platform on all supported devices, Java devs can finally develop apps for it.

· Mobile Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

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.

NOTE 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 has been installed on 300 million PC’s and devices making it a significant platform and app store. Microsoft has traditionally been quite strong in the enterprise and the ability to sell into that market thru its app store (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 app store 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.


NOTE

This is currently optional, you can send a build without configuring a certificate to test this on your local machine


Open the new Codename One preferences options in the right click of the project:


Open the new Codename One preferences options in the right click for the project
Scroll down using swipe and click the UWP section:

Scroll down using swipe and click the UWP section

You can now set a certficiate file and password for signing a universal app:

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 other options for desktop & the old Windows Phone support…

The new Windows UWP target:

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 write up 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:

Image title


What’s Next?

The next set of steps depends 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.

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda

Topics:
windows ,uwp ,univeral apps ,java ,mobile ,codenameone ,cross platform ,cross platform app development ,cross-compile

Published at DZone with permission of Shai Almog, DZone MVB. See the original article here.

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 }}