PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Call to JavaLoad
  • Java version 1.2 (or sub-version), 1.3 (or sub-version), 1.4 (or sub-version), Java 6
  • Java version 1.1 (or sub-version)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
JavaLoad (Function)
In French: JavaCharge
Specifies the location of user classes required to run the Java application or the Java applet.
Example
// Specifies the location of .class files of the Java application to start
// Note: Specify the names of folders/directories and the names of .jar or .zip
// (and not just the name of .class)

JavaLoad("D:\sources\Example\JavaTest")
// Defines the java.library.path variable to the c:\tmp value
JavaLoad(".", "-Djava.library.path=c:\tmp")
Syntax
<Result> = JavaLoad(<Location> [, <Parameters>])
<Result>: Boolean
  • True if the specified paths exist,
  • False otherwise.
<Location>: Character string (with quotes)
List of locations separated by:
  • semicolons (";") in Windows,
  • colons (":") in Linux.
The locations can correspond to:
  • Full or relative path of .jar files,
  • Full or relative path of directories containing the .class files.
    Caution: don't specify the full path of a .class file but only the path of directory that contains it.
<Parameters>: Optional character string (with quotes)
Options for initializing the Java library (ignored for the libraries version 1.x). These strings must have the following format:
"-D<Name>=<Value>"

If several options must be specified, the corresponding strings must be separated by a comma.
Options for initializing the Java library. These strings must have the following format:
"-D<Name>=<Value>"

If several options must be specified, the corresponding strings must be separated by a comma.
Remarks

Call to JavaLoad

A single call to JavaLoad must be performed in a WINDEV application or in a WEBDEV site.
Java JavaLoad can be called as many times as necessary.

Java version 1.2 (or sub-version), 1.3 (or sub-version), 1.4 (or sub-version), Java 6

  • To use JavaLoad, the JAVA runtime environment (J2SE JRE) or the development environment (J2SE SDK) must be installed on the computer.
  • The error message "Failure loading JVM.DLL" means that the JAVA.DLL file was not found on the current computer. The directory containing the JVM.DLL file must be added to the PATH variable of current computer.
Note: the search for JVM.DLL file is performed as follows:
  • read the JDK in the directories if the JRE is not installed: Read the following keys in the registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment, value CurrentVersion
    HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\<CurrentVersion>, value RuntimeLib
  • if the previous information is not found, read the following keys:
    HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit, value CurrentVersion
    HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\<CurrentVersion>, value JavaHome
  • search in the current directory of application then in the directories of PATH.
Note: The registry dos not allow you to find out whether the jvm.dll file is in 32 or 64 bits. If the jvm.dll file is in 32 bits, JavaLoad can be called from a 32-bit application only. If the jvm.dll file is in 64 bits, JavaLoad can be called from a 64-bit application only.
Note: the search for JVM.DLL file in Windows and for "libjvm.soc" file in Linux is performed as follows:
  1. In Windows, search on the registry keys:
    • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE: "CurrentVersion" value, then "RuntimeLib" value in <version> sub-key.
    • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment: "CurrentVersion" value, then "RuntimeLib" value in <version> sub-key.
    • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JDK:: "CurrentVersion" value, then "RuntimeLib" value in <version> sub-key.
    • HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit: "CurrentVersion" value, then "RuntimeLib" value in <version> sub-key.
  2. For all platforms (Windows and Linux), search from the directory given by the "JAVA_HOME" environment variable.
  3. For Linux, search in the "/etc/alternative/jre" directory.
  4. For all platforms (Windows and Linux), search in PATH for finding libraries of operating system.

Java version 1.1 (or sub-version)

  • The full path of CLASSES.ZIP (system classes of JAVA) must be specified as well as the path of the application classes. This information is separated by semicolons (";").
    Example:
    // Specifies the location of Classes.ZIP and *.class of the Java application to start
    JavaLoad("D:\sources\AppJava1\classes.Zip;D:\sources\Example\JavaTest")
  • The error message "Failure loading JVM.DLL" means that the JAVA.DLL file was not found on the current computer. The directory containing the JAVAI.DLL file must be added to the PATH variable of current computer.
Related Examples:
WD JAVA Calls 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)
Components
WINDEVWEBDEV - Server codeReports and Queries wd230jav.dll
Linux wd230jav.so
Java wd230java.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment