|
|
|
|
- Call to JavaLoad
- Error
- Parameters that must be passed to the Java function
- Note
JavaExecuteFunction (Function) In french: JavaExécuteFonction Starts a specific static function of a given Java class. Caution: - The path of the class to run must be specified by JavaLoad.
- The Java class run must implement the following method: "static public <Return type> <Function name>".
Syntax
JavaExecuteFunction(<Class name> , <Function name> , <Type of return> [, <Parameter 1> [... [, <Parameter N>]]])
<Class name>: Character string Name of the class containing the function to run. This parameter is case-sensitive: it must exactly correspond to the name specified in the class.
If the class is contained in one or more packages, the full path of this class must be specified with the "/" character as separator. Example: "MyPackage/MySubPackage/MyClass". <Function name>: Character string Name of the Java function to run. This parameter is case-sensitive: it must exactly correspond to the name specified in the class. <Type of return>: Integer constant Return type of the Java function among the following values: | | javaBoolean | Type of return value: Boolean. | javaByte | Type of return value: Byte. | javaChar | Type of return value: Character. | javaDoubleReal | Type of return value: Double Real. | javaInteger | Type of return value: Integer. | javaLongInteger | Type of return value: Long Integer. | javaReal | Type of return value: Real. | javaShortInteger | Type of return value: Short Integer. | javaString | Type of return value: String. | javaStringUnicode | Type of return value: Unicode String. | javaStringUTF8 | Type of return value: String in UTF8 format. | javaVoid | Type of return value: Void. |
<Parameter 1>: Type corresponding to each parameter Parameters expected by the Java function. These parameters must have the same type as the parameters expected by the Java function. Only the simple types can be used (see the Notes). <Parameter N>: Type corresponding to each parameter Parameters expected by the Java function. These parameters must have the same type as the parameters expected by the Java function. Only the simple types can be used (see the Notes). Remarks Call to JavaLoad - A single call to JavaLoad must be performed in a WINDEV application or in a WEBDEV site.
JavaLoad can be called as many times as necessary. - One of the following versions of SUN Java virtual machine is required: version 1.1, 1.2 (or sub-version), 1.3 (or sub-version), 1.4, 1.5 or 6.
Error - If an error occurs when running the specified class, the corresponding error message is displayed in a message box and the WINDEV application (or the WEBDEV site) is stopped.
- Possible reasons for the problem (class not found for example):
- wrong syntax in the class name (wrong case, class contained in a package and full path not specified, etc.)
- class compiled with a version of SUN Java virtual machine and run with an earlier version of JRE...
Parameters that must be passed to the Java function Only the "simple" types can be used: integer, real, string, boolean. Using another WLanguage type triggers a WLanguage error. Therefore, you cannot call a Java function containing "byte" or "short" parameters. To call this Java function with JavaExecuteFunction, the "byte" or "short" parameters of the Java function must be changed to "int" parameters. Note The ".class" file is the result of the compilation of one or more files containing Java code. It does not contain the source code of the application but an intermediate format ("bytecode") intended to be interpreted by the Java virtual machine (JVM).
Related Examples:
|
Training (WINDEV): WD JAVA Calls
[ + ] WD JAVA Calls is an example containing two configurations of project: - A "Windows Application" configuration that is used to create the executable of the application - A "Java Application" configuration that is used to create the Java archive (.JAR) of the application This example is supplied with a JAR archive named "JavaFunction" external to the application. It presents the call to the methods of classes of this JAR archive via the WLanguage function named JavaExecuteFunction. This example also explains how a memory table can be filled (identical in Java mode and in Windows mode)
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|