Advertisement

Migrating From Applets to Java Desktop Apps in JavaFX

Principal Product Manager for Java at Microsoft
Jan. 23, 2016
Advertisement

More Related Content

Viewers also liked(20)

Advertisement

Similar to Migrating From Applets to Java Desktop Apps in JavaFX(20)

More from Bruno Borges(20)

Advertisement

Migrating From Applets to Java Desktop Apps in JavaFX

  1. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Migrating from Applets to Java Desktop Applications Evolve your Applet-dependent website to a better and safer distribution model with JavaFX Hybrid Desktop Applications Bruno Borges Principal Product Manager Oracle Corp. May, 2015
  2. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 3
  3. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Why are you still using Applets? A brief history check The Future of Applets is tied to Browsers Seamless Migrate from Applet/Browser to Java Desktop App Hybrid JavaFX Desktop Applications Distribution Models for Java Desktop App 1 2 3 4 5 4
  4. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Why are you still using Applets? A brief history check 5
  5. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Applets used to do what browsers couldn’t 6 And provided easy distribution model for fully capable desktop applications
  6. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Applets and Browsers these days • HTML5, CSS3, Javascript… Browsers are well capable for most use cases – 3D, Local storage, Canvas, Audio processing, etc • Applets still exist for some reason – Distribution model still interesting • Install Java, hit a URL on the browser and you are ready to go – Security requirements – Communication with hardware devices in a “transparent” way – Proprietary network protocols – Advanced and specialized file transfer – Local cryptography, desktop sharing, audio/video streaming, etc 7
  7. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 8 Most banks in Brazil require 3-step verification Example: Internet Banking Authentication Model Segurança Internet Banking Internet Banking Creden tials • User/Pass • Bank Account ID • SSN Hard ware Token • Hardware Auth Token • Token Card • SMS Token Device • Access Origin Check • Singularity
  8. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Why are you still using Applets? A brief history check. The Future of Applets is tied to Browsers Seamless Migrate from Applet/Browser to Java Desktop App Hybrid JavaFX Desktop Applications Distribution Models for Java Desktop App 1 2 3 4 5 9
  9. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | The Future of Applets depend on Browsers Browsers can, and already have showed signs to drop support on Applets 10
  10. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | • Advantage – Semi-transparent execution model • Disadvantage – Java “gratis” at java.com • Highly Dependent – Web Browsers – Java Browser Plugin – Operational Systems • “Necessary Evil” – Automatic Updates on Windows 11 Applets on Browsers – Current Access/Distribution Model Web Browser Your website Java Applets
  11. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Applets on Browsers – 99.99% of cases • Google Chrome – NPAPI to be dropped in 2015 – As consequence, will drop support to execute Java Applets • Mozilla Firefox – Initially considered to drop support, but after community backfire decided to continue supporting it, but disabled by default aka “Plugin Activation” – User must manually allow execution through Firefox’s own security dialog – Java will also ask depending the case, for execution permission • In the end, it is up to browsers to allow/support execution of Applets 12 The usual and most common runtime environment for Applets
  12. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Why are you still using Applets? A brief history check. The Future of Applets is tied to Browsers Seamless Migrate from Applet/Browser to Java Desktop App Hybrid JavaFX Desktop Applications Distribution Models for Java Desktop App 1 2 3 4 5 13
  13. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Seamless Migrate from Applet/Browser to Java Desktop App You don’t want nor have to rewrite your solution! Reuse what you already have. 14
  14. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 15 You may be already doing this, known as Hybrid Mobile Applications From a Browser+Applet web application, to a Desktop application with wrapped embedded website +
  15. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 16 You don’t have to shutdown your website+applet access model right away! Keep Your Web Application. Distribute a New Access Model Web Browser Your website Applets Java Desktop Application Embedded Browser with your website Libraries
  16. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Browser and Applets, Desktop App and Libraries • Web applications that depend on invisible Applets – Javascript can be smart enough to communicate with Java if running on Embedded Browser inside a Java Desktop application, while also working with legacy applets if running on a browser – Java code injects Java objects of legacy Applets features in the DOM tree of embedded Java browser • Web applications with visible Applets (AWT/Swing) – These should be features from outside the embedded browser • Example: file transfer feature as a popup (similar to Swing’s JDialog) from the Java desktop application, while still being able to communicate with the page in embedded browser 17 Combining two access models while reusing code
  17. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Why are you still using Applets? A brief history check. The Future of Applets is tied to Browsers Seamless Migrate from Applet/Browser to Java Desktop App Hybrid JavaFX Desktop Applications Distribution Models for Java Desktop App 1 2 3 4 5 18
  18. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Hybrid JavaFX Desktop Applications JavaFX Introduction and Resources 19
  19. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 20 Hybrid JavaFX Desktop Application – Architecture Windows Mac OS XLinux Oracle JRE JavaFX Application Embedded Browser Native UI Controls Native Hardware Access HTML5, CSS3, JavaScript part of your application (remote or local) Native JavaFX or Embedded Legacy Swing Controls Reuse your Java libraries for hardware integration (ie: functionality from legacy Applets) Bundle the JRE with your application for native installers One unified desktop application
  20. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | • Advantage – Controlled “web” environment – Reuse your existing web application – Reuse your existing Java libraries or UI controls (JApplets) • Highly Independent – Java “gratis” or Oracle support contract – Controlled Java updates – Independent of 3rd-party browsers (Firefox, Chrome, Safari, IE, etc) 21 New Access Model for your Web Application Java Desktop Application Embedded Browser with your website Legacy Applets and/or New Rich Features, as Libraries
  21. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | JavaFX • Java SE 8 – Bundled with new Javascript Engine: Nashorn – Follows ECMAScript 262 v5.1 • JavaFX 8 – Supports embedded Java Swing components (migrate visual JApplets) – WebView • Support for HTML5 tags, CSS3, Javascript, and DOM tree – WebEngine supports bi-directional calls between Java APIs and Javascript in webpages loaded inside WebView 22
  22. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | JavaFX 8 – Web Engine • html5test.com • acid3.acidtests.org • webkit sunspider 0.9.1 test 23 Standards compatibility and performance analysis Firefox 29: 244.8ms Chrome 34: 259.8ms JavaFX 8: 252.4ms http://www.websocket.org/echo.html
  23. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Program Agenda Why are you still using Applets? A brief history check. The Future of Applets is tied to Browsers Seamless Migrate from Applet/Browser to Java Desktop App Hybrid JavaFX Desktop Applications Distribution Models for Java Desktop App 1 2 3 4 5 24
  24. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Distribution Models for Java Desktop Apps How to distribute your application to your users 25
  25. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Before distributing, you must package it • Tool name: javapackager (pka javafxpackager) – Support on NetBeans out of the box – Also as Apache Ant task • Supported Installers – Windows: EXE/MSI – Mac OS X: DMG – Linux: RPM/DEB – Others: installer/image 26 Java tool to package your app and JRE on native installers
  26. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Options of distribution models • Applet and web application, on a browser – This is where you are today • Java Web Start – Java Desktop application loaded off of browser. Security checks are kept • Standalone: download links of native installers or the JAR file – Native installers: user double click and install as desktop standalone application – JAR file: user must have Java previously installed • Appstores for General Purpose Desktops/Laptops – Users are comfortable with this model, since it’s how they install apps on mobile 27
  27. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Java Web Start • Application files (JARs), like Applets, are hosted on website server – User clicks on a link to load the application via JWS – When remote JAR files are updated, JWS automatically updates on user’s computer • With a Hybrid JavaFX Desktop application in place, this is the easiest model to move forward before a full replacement, off of browsers – Users will perceive as a “new window” • Disadvantages – Java must be installed prior to execution – Developer must still keep up-to-date on new security Java updates, due to automatic Java updates in some operational systems 28
  28. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Download Link • Provide users with a “Download” section on the website – JAR download for reduced package size • User must have Java installed – Native installers per operational system • JRE and application bundled into native installers for Windows/Mac/Linux 29
  29. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | Appstores for General Purpose Desktops/Laptops • Publish the native installers (JRE+application bundled) on 3rd-party appstores for PCs – Decide which version of Java JRE is bundled. Won’t conflict with any other JRE installed, or bundled with another application – Keep control of when to upgrade the version of JRE bundled with the application 30
  30. Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 31 Comparison based on external users accessing the application from their own PCs Differences between Distribution Models for the Application Developer Applet Web Start Download Appstore Unnecessary to Have Java Previously Installed NO NO YES YES Independent of Java Browser Plugin NO YES YES YES Unaffected by Java “gratis” Auto Updates NO NO YES (1) YES Unaffected by Java LiveConnect™ Constraints NO YES YES YES Unaffected by Browsers Restrictions NO YES YES YES Application Auto Update for Users OOTB YES YES NO YES Has Control of Which Java Version Update NO NO YES YES Has Control of Runtime Environment NO NO YES YES (1) NO if user downloaded JAR file only, without bundled JRE

Editor's Notes

  1. This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template. One of the Safe Harbor slides must be used if your presentation covers material affected by Oracle’s Revenue Recognition Policy To learn more about this policy, e-mail: Revrec-americasiebc_us@oracle.com
  2. Created by Sun in 1995 to provide an execution environment for visual Java applications with a simple distribution model, and to “run everywhere” Local data processing 2D and 3D visualization Audio/Image processing Animations - Hardware integration
  3. Some sort of native plugin has to be installed on users’ computers to provide Hardware Token and/or Device Singularity/Access Origin. Applets are commonly used.
  4. Why “semi-transparent”? - Your website may be selling the idea of “access from everywhere through a browser”, but you require Java to execute Applets. Means users have to do 2 things before actually access your website: (a) install a browser your modern website is compatible with, and (2) install Java. Why is “Java gratis at java.com” a disadvantage? - In cases where users access websites with Applets from their own personal computers they install Java from java.com and keep up to date from there. Your company IT has no control of these computers and thus it is technically unpractical to acquire commercial support for Java. Why “Highly Dependent”? Some operational systems may impose difficulties at setting up Java correctly to run Applets on browsers (i.e. Linux) Web browsers may block, or require extra steps, to execute Applets. They are in control. Java Browser Plugin is the piece of Java that actually runs Applets. Changes here may affect how Applets are executed, and may require changes in the Applet code/manifest/signature. Why is Automatic Update a “Necessary Evil” ? - Oracle issues security updates to Java to keep users safe. - These updates may require applets to also be updated to comply with new security requirements. - Applets not updated or compliant with new requirements may be blocked by these security updates.
  5. Chrome “press-release” - http://blog.chromium.org/2014/05/update-on-npapi-deprecation.html Firefox “press-release” - https://blog.mozilla.org/futurereleases/2013/09/24/plugin-activation-in-firefox/
  6. WebView is the Embedded Browser component of the JavaFX Platform Bundle JRE with your application. When you package your application in this architecture, the JRE is installed as part of your application, not as a pre-required software. This means it will be only used by your application and not shared with other apps nor the browsers. It is as if JRE+Your_App were one thing only.
  7. Why “Advantages”? Controlled web environment: the Java Virtual Machine provides an environment not tied to specific operational systems, and since now it provides its own embedded browser, it is now also not tied to specific web browsers if one wants to build their “own browser” using the Java WebView component Reuse your existing web app: you don’t have to write from scratch your web application (but may be require to adapt/adjust/tune). You can also continue providing users access to your web application through regular browsers that still support applets Reuse existing Java libs and UI controls: Java libraries can be easily reused within a Java desktop application. For UI controls, these may require refactoring, but JavaFX applications can embed Java Swing controls (usually used inside JApplets) Why “Highly Independent” ? You may choose to package your application with the Java “gratis” available at java.com. But remember these are not supported and they may reach End of Public Updates that may include security fixes and improvements. Since you will be in control of which JRE is bundled with your app, this technically enables you to consider a support contract with Oracle. Controlled Java Updates: again, since you control the packaging of JRE with your app, you also control when to update your application to a newer JRE and repackage it for a new version bundle. Your users won’t be required to upgrade to a newer version when Oracle issues a new update at java.com, because JRE is bundled as part of your application. Independent of 3rd-party browsers: this architecture provides an independent solution of 3rd-party browsers and focus on only the Java embedded browser. You are in control of it.
  8. JavaFX’s WebEngine is well capable of running most websites. Quake 3D implemented in Javascript and CSS ain’t one.
  9. As previously noted, the auto update feature is important to keep users safe. But application developers must keep up-to-date as well when Oracle issues a new security update.
  10. Enterprises these days are releasing their own native/hybrid mobile applications for iOS and Android. Still, they ignore Windows Store, Mac OS X Store and Ubuntu Software Center (Linux).
  11. This table illustrates an analysis of distribution models by considering use cases of customer applications being accessed by unmanaged computers. IMPORTANT The reason Commercial Support for Oracle Java is not technically feasible for Applets and/or Java Web Start is that external users (non-employees of customer holding support contract) will likely install Java “gratis” from java.com, and access from their personal desktops/laptops. If there is a problem and Oracle issues a fix for the customer, this customer would have to distribute this special JRE for their external users. The scenario is overly complicated and should be avoided. Commercial Support may be technically feasible for Applets and/or Java Web Start only when computers are managed by customer who owns the Java support contract. It should also be considered that this is for internal users only. - i.e. desktops/laptops owned by the customer and managed by an IT department
Advertisement