The disadvantage of this method is that it relies on the browser JVM to load and execute the HelloWorld class. Considering that there are a variety of browsers in the market, they do different ways of java, making the applet's deployment into a fearful thing. You must ensure that the applet is run in the test-tested JVM. We don't ask the browser to run Java, and ask the browser to install and run us to run the Applet's JVM. In IE, we can accomplish this task by using the flag, this flag may vary, for example, in Netscape Navigator is . The modified web page is as follows:
< Param name = "code" value = "helloWorld.class"> object> body> The above web page will enable the browser to check if the object of the specified ClassID is Already installed, if not installed, download the JVM from the specified URL and install. Then the browser performs a plugin and downloads and displays the applet. We can learn its working principle through http://192.9.48.9/products/plugin/1.3/demos/applets/graphlayout/example1.html. For more detailed information about Java plug-ins, please refer to Sun's website.
The advantage of the plug-in is that it can support all browsers on various operational platforms. In addition, it provides a guaranteed execution environment, plugins only need to be installed, you can buffer all Applets, enable access to the website again It is very easy. One of the biggest shortcomings of this method is that before running the applet, you must download a size of 5MB plug-in, which is especially unbearable on a low speed internet connection. In fact, if your applet is just a wattock at the top of 5kb page, downloading a 5MB plugin is not paid for this.
Solution 2: Using Java Web Start
Another way to deploy Java applications is Sun's Java Web Start, which is essentially similar to Java plug-ins, but there is a significant difference in the first step. Java Web Start requires artificial installation on each desktop, which is far less automatically installed. The installation of Java Web Start is quite simple. Once installed, it can be downloaded and installed on the application of Java Web Start. Like the plugin, the application is also released through the Internet.
According to my experience, the Java plugin is similar to Java Web Start, but is better than the user affinity than Java Web Start, because it requires less administrator or user intervention. There are also some companies to create their own functionally similar deployment tools, which are sometimes easy to use than Java Web Start. For example, Sitraka's DeployDirector is better than Java Web Start and is also simpler installation.
All in all, by using Java plug-ins and Java Web Start, Swing Application By the deployment is much simpler and safe than the original, but still more complicated than clicking a HTML page with only JavaScript. Moreover, some users may have the feeling of being stressed on the steps that need to be completed on the local machine, or there is no advantage of Swing, but if you need a dynamic GUI user interface, users enjoy more flexibility, No way is better than using Swing Applet. In addition, if the entire development is based on Java, there is no need to map between HTML request data and internal structures. RMI can provide fast two-way network calls, which can call client applications to update the display content based on servers.
Solution three, deploy Java Swing in pure HTML
Although HTML and SWING have their own advantages and disadvantages in developing client applications, it is obvious that the ideal solution should be supported. However, since these two techniques have a large difference in essence, only one of them can be used in one application. Although most users prefer Swing fast interactive client applications, but download and install JRE on the client system is not always a good choice. Sometimes the restrictions on security and firewalls make RMI difficult to run on the network. In this case, we need an interactive client application that can run on all systems, even if we can use a browser. Creamtec's Webcream can act as a bridge between Swing-HTML.
Webcream is a Java tool that provides automatic internet access for GUI-based Java applications and Applets, allowing us to utilize AWT and SWING implementation of the GUI front-end application, while automatically accessing the HTML. To a certain extent, WebCream can be regarded as a dynamic Java-to-HTML conversion tool that can instantly convert the frames and conversations in Java to HTML. Then, the WebPage behavior is then imitated as a GUI event to keep the application original logic. Webcream does not require modification of existing forms and business logic, and does not need to learn any new API, which is intended to issue existing applications and Applets. WebCream just sets the Internet server and describes the tools for describing the application properties, which has all features and is free. Webcream also does not need to install on the client's machine, even no browser supports Java, because all of the browser receives all HTML code.
As far as I know, only Webcream has such a function, and there is no other tool to provide similar solutions. However, there are also some products that use different ways to have Internet access functions that were originally not designed for the Internet. Windows 2000 has a built-in Terminal Server service that allows users to access servers remotely by logging in local system. Like the MetAframe of the Citrix System, the terminal server sends a video stream to the remote terminal and imitates the user's behavior for applications running on the server. It can run well on the high-speed network, and the performance on the low speed network is not satisfactory. It is also problematic in Java applications because they do not use this machine's drawing and scroll routines. The scalability of the terminal server is not too strong, because each user is running a copy of it. Applications converted by Webcream are different from applications running on the local system, but its performance is better because only users are submitted to a page. All users with application services with WebCream functions can share a JVM, so it can also greatly reduce resource consumption. To demonstrate WEBCREAM working principle, the following two diagrams show how a sample GUI application runs in the HTML front-end application. Figure 1 is a running GUI application (source code), Figure 2 shows that WebCream manages the same application, the window represents a web page in the browser.
(Figure 1: GUI program in the example)
(Figure 2: GUI after Webcream)
Swing-HTML conversion methods are not suitable for all users, and WebCream can enhance the value of Swing front-end applications to a certain extent to enhance the value of Swing front-end applications to access front-end applications via HTML. There are 95% of applications that can be seamlessly convert to HTML, and another 5% of the program requires changing the expression and processing of data.