- What is a Java application?
- Why develop a Java application with WINDEV?
- Principle for generating a Java application with WINDEV
- Features for a Java project
- Creating a Java project
- JAVA RAD
- Test of Java project in the editor
- Compiling a Java project in WINDEV
- Creating a Java archive
- Deploying a Java application
16. Java application in practice
WINDEV allows you to generate Java applications without even knowing the Java language. 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 and it requires the Java runtime in order to be run.
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've developed a WINDEV application for Windows and you want to make this application accessible independently of the operating system? Generate a Java application so that the users working with Mac OS X for example will also be able to use your application.
This gives you the ability to share your network applications.
Principle for generating a Java application with WINDEV
As mentioned above, there is no need to know the Java language to develop a Java application with WINDEV. You develop your application in WLanguage like any other WINDEV application and, when compiling the project, the windows and the WLanguage functions are automatically converted into 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 the forthcoming versions.
Features for a Java project
Creating a Java project
The method for creating a Java project is the same as the method for creating any WINDEV project:
- Click among the quick access buttons. The element creation window appears: click "Project".
- The project creation wizard starts.
- In one of the first steps, the wizard allows you to choose the generation mode of your project. To do so, 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 modified at any time. All you have to do is create a new project configuration.
As soon as the project is configured as a Java project, all the tools available in WINDEV are automatically configured for the Java project:
- The window RAD or the full application 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.
: we advise you create a new WINDEV project to develop a Java application rather than transform a WINDEV application into Java.
Like for any project associated with an analysis, the RAD can be used to generate the windows of your application.
The RAD 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 is used to specify the type of connection to the database:
- HFSQL (in Windows or Linux): the standard window creation wizard is proposed.
- JDBC: you can then specify the parameters for connecting to the database that uses the JDBC driver.
Test of Java project in the editor
During the test of a Java project (
), the project is compiled and run in Windows. The project is not compiled in Java.
To run the Java application, you must start the ".Jar" file found in the EXE directory of your project.
Compiling a Java project in WINDEV
The compilation of a Java project is used to:
- identify the programming errors found in the WLanguage code
- see the controls, events, WLangage functions not available in Java. These errors appear in purple in the "Compilation errors" pane.
See the online help for more details.
: 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" pane, 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 a Java application. This setup procedure is available for Windows only. The setup program will be an executable and it will be used to install the necessary files as well as the Java runtime (JRE). For the other platforms, your files will have to be deployed manually.
To start the setup creation wizard, go to the "Project" pane, "Generation" group and click "Setup procedure".
Click [Add] to post a comment