A development method of cross-platform desktop application

By embedding the JxBrowser browser in a desktop application and interacting with Java Swing, the cross-platform adaptability problem of domestically produced secure and reliable computer equipment is solved, enabling cross-platform desktop application development, simplifying the development process, and improving system security and compatibility.

CN116225400BActive Publication Date: 2026-05-08HUNAN SCI & TECH UNIV TIANHE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN SCI & TECH UNIV TIANHE COMM CO LTD
Filing Date
2023-02-23
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

In the existing technology, the domestic operating system of domestically produced secure and reliable computer equipment is incompatible with the Windows series computer chip core of the x86/x64 architecture, which makes development complex and inconvenient. In particular, the cross-platform adaptability of complex UI interface programs is poor, and the development workload of C/S structure desktop applications is large.

Method used

This project utilizes Java Swing to develop a client-side desktop application that embeds the JxBrowser browser into the client. The browser content is displayed in full screen, the navigation toolbar is hidden, and Java Swing interacts with the local database and operating system. This allows for the development of a client/server system and the generation of desktop applications suitable for Linux (ARM architecture) and Windows (X86 architecture).

Benefits of technology

It enables cross-platform desktop application development, solves the adaptation problem of different operating systems, reduces development workload, improves system security and compatibility, adapts to domestically produced safe and reliable computer hardware, and does not require modification of business logic programs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225400B_ABST
    Figure CN116225400B_ABST
Patent Text Reader

Abstract

The application discloses a kind of development methods of cross-platform desktop application, and the client of C / S mode system is developed;Java Swing is used to develop client program, respectively in client program Embedding JxBrowser carries out communication interaction, develops Java Swing and local database operation and develops Java Swing and local operating system interactive operation;Web program is developed, and Web program is deployed to server and runs;JxBrowser is loaded into Web program link;JxBrowser and Java Swing interactive operation are developed;Java Swing and local database operation and development Java Swing and local operating system interactive operation are merged with S4 whole debugging running program;Program is intended to be published, check whether the Windows and Linux program package in development engineering is complete, and the target client operating system category is selected.The application solves the adaptation problem of domestic safe and reliable computer software and hardware, does not need to modify business logic program, directly generates desktop application program of domestic safe and reliable computer by generating program, and communication mode is diversified and system security is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer program technology, and more specifically to a method for developing cross-platform desktop applications. Background Technology

[0002] The best development model for cross-platform compatibility in the current technology is the B / S model, which is browser-to-server. It is independent of the client's platform. As long as the client supports the installation of a browser with a specified framework, client operating system independence can be achieved. You only need to develop the program according to web development technology and deploy it to the server.

[0003] Different browsers, and even different versions of the same browser, may display UI elements with subtle differences. This can cause some finely detailed interfaces to malfunction. However, for most business systems or portal websites, these subtle differences can be completely ignored, or developers can take these subtle differences into account during the design phase to ensure that different browsers or different versions display the same information.

[0004] In information technology applications related to public safety, to utilize proprietary communication systems and protocols, maintain a robust system UI structure, and facilitate large-screen projection in command centers (e.g., civil defense alarm systems), a client / server (C / S) architecture is required. This necessitates independent client-side desktop applications that can be used directly upon opening. However, the desktop application is highly dependent on the client computer's operating system type and version. To adapt to various operating systems and versions, different desktop applications must be developed, especially for programs with complex UIs, significantly increasing the development workload.

[0005] In the existing technology, domestically produced secure and reliable computer equipment generally deploys a domestically produced operating system with a Linux kernel. The chip core of such products is based on the ARM architecture. However, many existing applications and management software support Windows-based computer products, whose chip cores are based on the x86 / x64 architecture. Directly installing them on domestic operating systems and domestic CPUs will not allow them to run, which is quite inconvenient. Summary of the Invention

[0006] To address the aforementioned technical problems, this invention provides a method for developing a cross-platform desktop application. By using Java Swing, the browser is embedded into the client's desktop application, and the browser's content is displayed in full screen within the desktop application while the navigation toolbar is hidden, thus serving as a relatively discreet browser.

[0007] To achieve the above objectives, the present invention adopts the following technical solution:

[0008] A method for developing cross-platform desktop applications includes the following steps:

[0009] S1. The client-side component of the proposed C / S mode system;

[0010] S2.1 Based on S1, develop client programs using Java Swing, embedding JxBrowser in the client programs for communication and interaction, developing Java Swing operations with the local database, and developing Java Swing operations with the local operating system.

[0011] S2.2 Based on S1, develop a web application, deploy the web application to the server and run it;

[0012] S3. Load the web application link from S2.1 using JxBrowser in S2.1 into S2.2;

[0013] S4. Based on S3, develop interactive operations between JxBrowser and Java Swing;

[0014] S5. Combine the development of Java Swing operations with the local database and the development of Java Swing interactions with the local operating system in S2.1 with S4 to run the program as a whole.

[0015] S6, based on S5, for the proposed release program, check whether the Windows and Linux packages in the development project are complete, and select the target client operating system category;

[0016] S7.1, based on S6, if the target client operating system type is selected as Windows, then the Windows client program generation instruction is executed, and the generated program runs on the Windows client;

[0017] S7.2, based on S6, if the target client operating system type is selected as Linux, then the Linux client program generation instruction is executed, and the generated program runs on the Linux client.

[0018] Preferably, in step S2.1, the development of Java Swing and local database operations is achieved by setting up a local database adaptation development process. This local database adaptation development process includes the following steps:

[0019] S2.1.1 Analyze software development requirements and prepare for the design of relational database tables;

[0020] S2.1.2. Use basic data types to define database fields and avoid using data types proprietary to a particular database software.

[0021] S2.1.3 Develop CRUD operations or perform data retrieval within the same database, and determine whether standard SQL statements can be used to achieve this.

[0022] S2.1.4 If it can be implemented using standard SQL statements, then write the database business logic code using standard SQL statements and call the execution result of the standard SQL statements in the Java program; if it cannot be implemented using standard SQL statements, then use standard SQL statements to retrieve the required data tables, call the execution result of the standard SQL statements in the Java program, and write the business logic that cannot be implemented using standard SQL statements in the Java program.

[0023] S2.1.5. Integrate and run the business logic in the software to ensure that the business logic has been implemented.

[0024] Preferably, the communication interaction operation of embedding JxBrowser in the client program in step S2.1 includes at least obtaining or setting the values ​​of form elements in the web page, mutual operation between the client Java program and the browser JavaScript script, and pushing client messages to the browser.

[0025] Preferably, the interactive operation between Java Swing and the local operating system in step S2.1 includes at least reading and saving local files, configuring or reading the dongle / encryption chip, clearing browser cache, managing browser processes, and monitoring local system parameters.

[0026] Preferably, the execution of the Windows client program generation instruction in step S7.1 includes: developing an IDE to automatically generate a program and copying a program package suitable for Windows to the target directory, copying the generated Windows client program to a computer with a Windows operating system to run it, and completing the application development.

[0027] Preferably, the execution of the Linux client program generation instruction in step S7.2 includes: the development IED will automatically generate a program and copy the program package applicable to Linux to the target directory, copy the generated Linux client program to a computer with a Linux operating system and run it to complete the application development.

[0028] Compared with the prior art, the present invention has the following beneficial effects:

[0029] (1) This invention uses a stable Chrome browser kernel (mainly using the JxBrowser cross-platform Java library) to embed the browser into the client's desktop application through Java Swing development. The browser content is displayed in full screen in the desktop application, while the navigation toolbar is hidden, making it a relatively discreet browser. When generating and publishing the desktop application, it can easily publish desktop programs for both Linux (ARM architecture) and Windows (X86 architecture). When developing business logic, it is only necessary to develop communication services in Java Swing and UI interfaces in the Chrome browser to solve different functional business systems without considering the client platform adaptation of the system. This solves the problem of domestically produced safe and reliable computer hardware and software compatibility. Without modifying the business logic program, a domestically produced safe and reliable computer desktop application can be directly generated through the generation program. The communication mode is diversified and the system security is high.

[0030] (2) This invention does not require replacing or upgrading the personnel or development technology of the existing software development team. It uses the previous development technology and applies the desktop application shell developed by Swing and JxBrowser in this invention to directly adapt the application system to the domestically produced safe and reliable computer.

[0031] (3) The UI displayed by the Chromium kernel in JxBrowser is a web page developed by HTML / CSS / JavaScript. The web page has fully achieved cross-platform compatibility. By applying the development method of this invention, the development of the desktop application system UI interface only needs one set to be fully adapted. There is no need to develop different UI interface layouts for different operating systems, which greatly saves the development time of the development team and the investment of the enterprise in R&D. Attached Figure Description

[0032] Figure 1 This is a flowchart illustrating the overall process of the present invention.

[0033] Figure 2 This is a flowchart illustrating the local database adaptation development process for this invention.

[0034] Figure 3 This is a timing diagram of the application of the present invention.

[0035] Figure 4 This is a structural diagram of the JxBrowser of the present invention. Detailed Implementation

[0036] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0037] like Figures 1 to 4 As shown, the present invention includes the following:

[0038] A method for developing cross-platform desktop applications includes the following steps:

[0039] S1. The client-side component of the proposed C / S mode system;

[0040] S2.1 Based on S1, develop client programs using Java Swing, embedding JxBrowser in the client programs for communication and interaction, developing Java Swing operations with the local database, and developing Java Swing operations with the local operating system.

[0041] Specifically, the Java client process mainly includes storing and processing data in the SQLite local database, handling Netty network connections, and processing and decrypting communication protocols. The JxBrowser embedded in the client program for communication interaction includes at least obtaining or setting form element values ​​on the web page, interoperability between the client Java program and the browser's JavaScript scripts, and pushing client messages to the browser. JxBrowser is responsible for rendering and displaying HTML / CSS / JavaScript components, which originate from data returned by the requesting web server process and information pushed by the web server. The main JavaScript frameworks used in this invention are Vue / jQuery / OpenLayers / EasyUI, where Vue and jQuery are the overall JavaScript development frameworks, OpenLayers is the technology for map display and processing, and EasyUI is the technology for page content display and processing. When applied to information technology fields related to public safety, most of the communication in the application business is confidential communication. Most of the communication protocols are proprietary to civil defense, and all communication protocols are encrypted with high security. In this embodiment, one of the important operations of the Java client process is the generation of sending instructions and the parsing of receiving instructions, as well as the encryption of sending instructions and the decryption of receiving instructions.

[0042] In this embodiment, JxBrowser is a cross-platform Java library embedded in the Chrome browser. User interactions on the Chromium browser's interface are transmitted to JxBrowser via IPC. JxBrowser then triggers the client Java process.

[0043] Developing Java Swing for interaction with the local operating system includes at least reading and saving local files, configuring or reading dongles / chips, clearing browser cache, managing browser processes, and monitoring local system parameters. After each operation is completed, a message is sent back to JxBrowser. JxBrowser then uses IPC to pass the message to the Chromium browser for rendering and display.

[0044] This invention utilizes a stable Chrome browser kernel (primarily employing the JxBrowser cross-platform Java library) and embeds this browser into a client-side desktop application using Java Swing. The browser content is displayed in full-screen mode within the desktop application, while navigation and other toolbars are hidden, providing a relatively discreet browser experience. Furthermore, when generating and publishing the desktop application, both Linux (ARM architecture) and Windows (x86 architecture) versions can be easily deployed. When developing business logic, only communication functions need to be developed in Java Swing, while the UI interface is developed in the Chrome browser. This addresses the challenges of adapting different functional business systems to different client platforms, thus resolving the issue of compatibility between domestically produced, secure, and reliable computer hardware and software. No modifications to the business logic are required; the application directly generates domestically produced, secure, and reliable desktop applications with diverse communication modes and high system security.

[0045] Developing Java Swing operations with a native database involves setting up an adaptation development process for the native database. This process includes the following steps:

[0046] S2.1.1 Analyze software development requirements and prepare for the design of relational database tables;

[0047] S2.1.2. Use basic data types to define database fields and avoid using data types proprietary to a particular database software.

[0048] S2.1.3 Develop CRUD operations or perform data retrieval within the same database, and determine whether standard SQL statements can be used to achieve this.

[0049] S2.1.4 If it can be implemented using standard SQL statements, then write the database business logic code using standard SQL statements and call the execution result of the standard SQL statements in the Java program; if it cannot be implemented using standard SQL statements, then use standard SQL statements to retrieve the required data tables, call the execution result of the standard SQL statements in the Java program, and write the business logic that cannot be implemented using standard SQL statements in the Java program.

[0050] S2.1.5. Integrate and run the business logic in the software to ensure that the business logic has been implemented.

[0051] S2.2 Based on S1, develop a web application, deploy the web application to the server and run it;

[0052] S3. Load the web application link from S2.1 using JxBrowser in S2.1 into S2.2;

[0053] S4. Based on S3, develop interactive operations between JxBrowser and Java Swing;

[0054] S5. Combine the development of Java Swing operations with the local database and the development of Java Swing interactions with the local operating system in S2.1 with S4 to run the program as a whole.

[0055] S6. Based on S5, for the proposed release program, check if the Windows and Linux packages within the development project are complete. Select the target client operating system category. Specifically, because desktop applications (such as those generated by Swing) run in Windows and Linux have completely different appearances, including auxiliary application packages (such as those generated by JxBrowser), for example, Windows executables are ".exe" files and packages are ".dll" files, while Linux executables are ".sh" files and packages are ".so" files. First, check if both Windows and Linux packages within the development project are complete enough to meet the standard for directly generating client programs.

[0056] S7.1, based on S6, if the target client operating system type is selected as Windows, then the Windows client program generation instruction is executed, and the generated program runs on the Windows client. Specifically, this includes: the development IDE automatically generates the program and copies the program package applicable to Windows to the target directory, and copies the generated Windows client program to a computer with a Windows operating system to run it, thus completing the application development.

[0057] S7.2, based on S6, if the target client operating system category is selected as Linux, including domestically developed secure and reliable operating systems such as NeoKylin and GalaxyKylin, then the Linux client program generation instruction will be executed. The generated program will run on the Linux client. Specifically, the development IED will automatically generate the program and copy the program package applicable to Linux to the target directory. The generated Linux client program will be copied to a computer with a Linux operating system and run to complete the application development.

[0058] like Figure 3 As shown, the application timing of the present invention includes page access, control command issuance, local operation, and service message push.

[0059] Page access: The browser address is set through the Java client process, or a link within the JxBrowser process, so that Chromium requests the PHP controller on the server side through the page navigation address. The PHP controller generates a web page (HTML / CSS / JavaScript) based on the page navigation address and then sends it to JxBrowser. The IPC inside JxBrowser renders and displays the page through Chromium.

[0060] Control command transmission: User interaction operations displayed on the Chromium browser interface are transmitted to JxBrowser via IPC. JxBrowser triggers the client Java process. While JxBrowser has a built-in JavaScript mechanism to trigger Java events, it is not very stable. This invention uses JavaScript to set the values ​​of two hidden fields, A and B, on the homepage. A records status characters, and B records the data to be transmitted. The client Java process continuously scans the value of A using a timer. Once a value is found, a Java event is triggered, and the value of B is retrieved for the event call. After the event is executed, the Java process clears the value of A; the value of B here represents the control content. Based on the obtained control content, the client Java process processes it to generate a control command protocol and encrypts it. The encrypted protocol is transmitted to the Netty Client via IPC. It is then sent to the Netty Server via TCP / UDP communication. The server then sends the command to the terminal.

[0061] Local Operations: User interactions on the Hromium browser's interface are transmitted to JxBrowser via IPC. JxBrowser triggers the client's Java process. While JxBrowser has a built-in mechanism for triggering Java events using JavaScript, it's not very stable. This invention uses JavaScript to set the values ​​of two hidden fields, A and B, on the homepage. A records a status character, and B records the data to be transmitted. The client's Java process continuously scans the value of A using a timer. Once a value is found, a Java event is triggered, and the value of B is retrieved for the event call. After the event is executed, the Java process clears the value of A; here, the value of B is the control content. Corresponding business operations are performed on the client, such as saving a file locally, selecting a local save location, or starting local microphone recording. After the corresponding operation is completed, a message is sent back to JxBrowser. JxBrowser then transmits the message to the Hromium browser via IPC for rendering and display.

[0062] Service message push: Messages from the terminal or automatically initiated by the server are transmitted to the service Java process via IPC. Based on the received message content, the service Java process processes the message, generates a control command protocol, and encrypts it. The encrypted protocol is then transmitted to the Netty Server via IPC. It is then sent to the Netty Client in the client application via TCP / UDP communication. The Java client process decrypts and parses the protocol to obtain the operation content. The corresponding business operation is executed on the client, such as saving a file locally, selecting the local save location, or controlling the local microphone to start recording. After the corresponding operation is completed, a message is sent back to JxBrowser. JxBrowser transmits the message to the Chromium browser via IPC for rendering and display.

[0063] The desktop application developed in this invention, when requiring local operation, essentially grants the same access privileges as the currently logged-in user on the operating system, making it easier to develop complex local operation business logic. The C / S architecture system used in this invention offers high local operation privileges, is compatible with multiple communication modes, allows for easy design of private protocols and encryption methods, and enables encryption factors to be bound to local hardware environment parameters, significantly improving overall system security. Furthermore, it supports all Web communication protocols through JxBrowser and TCP / UDP communication through Netty, ensuring adaptability to various communication types within the application system.

[0064] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of the present invention. Therefore, any modifications, equivalent changes, improvements, etc., made in accordance with the claims of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for developing cross-platform desktop applications, characterized in that, Includes the following steps: S1. The client-side component of the proposed C / S mode system; S2.1 Based on S1, develop client programs using Java Swing, embedding JxBrowser in the client programs for communication and interaction, developing Java Swing operations with the local database, and developing Java Swing operations with the local operating system. S2.2 Based on S1, develop a web application, deploy the web application to the server and run it; S3. Load the web application link from S2.1 using JxBrowser in S2.1 into S2.2; S4. Based on S3, develop interactive operations between JxBrowser and Java Swing; S5. Combine the development of Java Swing operations with the local database and the development of Java Swing interactions with the local operating system in S2.1 with S4 to run the program as a whole. S6, based on S5, for the proposed release program, check whether the Windows and Linux packages in the development project are complete, and select the target client operating system category; S7.1, based on S6, if the target client operating system category is selected as Windows, the development IDE will automatically generate a program and copy the program package applicable to Windows to the target directory. The generated Windows client program will be copied to a computer with a Windows operating system to run and complete the application development. S7.2, based on S6, if the target client operating system type is selected as Linux, the development IDE will automatically generate the program and copy the program package applicable to Linux to the target directory. The generated Linux client program is then copied to a computer with a Linux operating system to run and complete the application development. The communication interaction operations in step S2.1, which involve embedding JxBrowser in the client program, include at least obtaining or setting the values ​​of form elements in the web page, the interaction between the client Java program and the browser JavaScript script, and the push of client messages to the browser. The interactive operations between Java Swing and the local operating system in step S2.1 include at least reading and saving local files, configuring or reading the dongle / encryption chip, clearing browser cache, managing browser processes, and monitoring local system parameters. In step S2.1, the development of Java Swing and local database operations involves setting up an adaptation development process for the local database. This local database adaptation development process includes the following steps: S2.1.1 Analyze software development requirements and prepare for the design of relational database tables; S2.1.2, Define database fields using basic data types; S2.1.3 Develop CRUD operations or perform data retrieval within the same database, and determine whether standard SQL statements can be used to achieve this. S2.1.4 If it can be implemented using standard SQL statements, then write the database business logic code using standard SQL statements and call the execution result of the standard SQL statements in the Java program; if it cannot be implemented using standard SQL statements, then use standard SQL statements to retrieve the required data tables, call the execution result of the standard SQL statements in the Java program, and write the business logic that cannot be implemented using standard SQL statements in the Java program. S2.1.

5. Integrate and run the business logic in the software to ensure that the business logic has been implemented.

Citation Information

Patent Citations

  • Design and implementing method of off-line indent gathering system

    CN101256644A

  • Cross-platform desktop GIS and starting method thereof

    CN105183491A