问题
I have been reading about project centennial (https://msdn.microsoft.com/windows/uwp/porting/desktop-to-uwp-root#preparing-your-desktop-app-for-conversion-to-uwp), and it occurs to me that there are many legacy line-of-business apps that are written in Java (not to mention Python/Tkinter, insert language/gui toolkit here, etc).
I can see a benefit in being able to market/distribute these through the Windows store (either internally for an enterprise or to the general public).
I was wondering if it is possible to turn a Java application into an AppX bundle (possibly using something like launch4j as an in-between step)?
回答1:
It is possible, using Project Centennial. Just do the conversion process using the Desktop App Converter using your installer in silent mode and that's it.
You can also use the installerless mode, just put everything (your app and jre) in a folder, create an exe which will call your java program, create your manifest and call makepappx. Everything is in the documentation. And the process is very similar to deploy java applications to Mac Store.
UPDATE
Due to the lack of information out there about packing Java applications for Windows Store, I created an simple skeleton using a demo app bundled in the JDK called SwingSet to ease a lot the process. Please check it: https://github.com/crramirez/uwp_bridge_java and contribute with your own needs to have a good starting point.
I also published a Java application to the store, so this procedure works.
Regards
回答2:
No you can't.
The installer part would be easy but those are just wrappers around the JRE. The problem is that the JRE (the actual VM) is too complex for UWP and uses a lot of low level API's that just can't be ported.
The only way I know of getting Java apps onto UWP is Codename One which is an open source project and a commercial entity (and my employer). Notice you will need to adapt your code to use the Codename One API which is inspired by Swing but quite different (and better).
A side benefit would be portability to all mobile devices (iOS, Android etc.).
回答3:
You can always use Install4J to create Multi Platform Java App installer and distribute your application.
来源:https://stackoverflow.com/questions/39005244/can-a-java-swing-desktop-application-be-converted-to-a-uwp-centennial-app-appx