- What is a Java application?
- Why develop a Java application with WINDEV?
- Generating a Java application with WINDEV
- Features of a Java project
- Creating a Java project
- JAVA RAD
- Test a Java project in the editor
- Compiling a Java project in WINDEV
- Creating a Java archive
- Deploying a Java application
16. Java applications in practice
WINDEV allows you to generate Java applications without previous experience in Java development. As for all WINDEV applications, the application is developed in WLanguage.
What is a Java application?
A Java application is entirely compiled in JAVA. If this application uses a database, this database must have a JDBC driver (MySQL, Oracle, etc.). This driver is specific to each database (it can be downloaded from the Web site of the database publisher).
HFSQL databases are accessed natively (in Windows and Linux only) via the SQL WLanguage functions. No additional driver is required.
A Java application corresponds to a ".jar" file. It requires the Java Runtime to be executed.
To compile (in Java) a Java project created with WINDEV, the Oracle J2SDK (version 1.4.2 or later) must be installed on the development computer. A version is available on the WINDEV setup media. This program can also be downloaded from the Oracle site.
Why develop a Java application with WINDEV?
You have developed a WINDEV application that runs on Windows and you want to make it accessible on any operating system? Generate a Java application so that Mac OS users can use your application, for example.
This allows you to share network applications.
Generating a Java application with WINDEV
As mentioned above, you don't need to have previous experience in Java development to develop a Java application with WINDEV. You can develop your applications in WLanguage like any other WINDEV application and, when compiling the project, the windows and WLanguage functions are automatically converted to Java.
Remark: the number of WLanguage functions that can be used in a Java project is limited in this version. This number of functions will increase in forthcoming versions.
Features of a Java project
Creating a Java project
A Java project can be created like any WINDEV project:
- Click in the WINDEV quick access buttons. The new element window appears: click "Project".
- The project creation wizard starts.
- In one of the first steps, the wizard allows you to choose the project generation mode. Select "Java archive" and continue.
By default, a WINDEV project for Java corresponds to a specific project configuration. The type of project generation can be changed at any time. Simply create a new project configuration.
Once the project has been configured as a Java project, all the tools available in WINDEV are automatically configured for the Java project:
- The window RAD or the full RAD is specific to a database handled by a Java application.
- The compiler indicates whether the project contains functions or controls that cannot be used in Java. A purple message is displayed in the "Compilation errors" pane.
- The creation of the archive makes it possible to generate a ".jar" file in the EXE directory of the project.
- The setup module only handles the files required to deploy the Java application.
: it is recommended to create a new WINDEV project to develop a Java application rather than converting a WINDEV application to Java.
As with any project associated with an analysis, you can use the RAD methodology to generate the windows of your application.
The RAD methodology takes into account all the specific features of Java generation (controls, processes, functions that can be used in a WINDEV application generated in Java).
Regardless of the type of window to generate, the first screen of the wizard allows you to enter the type of connection to the database:
- HFSQL (in Windows or Linux): the standard window creation wizard appears.
- JDBC: you can specify the parameters for connecting to the database that uses the JDBC driver.
Test a Java project in the editor
When a Java project is tested (
), the project is compiled and run in Windows. The project is not compiled in Java.
To run the Java application, you must run the ".Jar" file located in the EXE directory of the project.
Compiling a Java project in WINDEV
A Java project is compiled to:
- identify programming errors in the WLanguage code
- see controls, events and WLanguage functions that are not available in Java. These errors appear in purple in the "Compilation errors" pane.
For more details on WINDEV elements not available in a Java application, see the online help.
: as mentioned in the What is a Java application?
section, the Sun J2SDK must be installed on the development computer to compile your project in Java.
Creating a Java archive
WINDEV allows you to:
- create and compile in a Java compiler the different Java files required by the application.
- create a Java archive that can be run directly:
- a standard Java application,
- a Java Web Start application.
To create the Java archive, all you have to do is create the executable: on the "Project" tab, in the "Generation" group, click "Generate". A wizard helps you create the Java archive.
Deploying a Java application
Like for any application, WINDEV allows you to create a setup program for Java applications. This setup procedure is available for Windows only. The setup program is an executable. It can be used to install the necessary files as well as the Java Runtime Environment (JRE). For other platforms, you need to deploy your files manually.
To start the setup creation wizard, go to the "Project" tab, "Generation" group and click "Setup procedure".