CreateJavaVM – PB Docs 126

JavaVM:

CreateJavaVM method

Description

Loads and initializes a Java VM or attaches an existing Java
VM to the current process.

Syntax

Argument

Description

javavm

An instance of the JavaVM class

classpath

A string specifying the classpath that
contains files required by the EJB server, such as the path to the
EJB classes

isdebug

A boolean that determines whether debug
information is saved to a file called VM.out in
the directory where the current application is located

Return Values

Integer. Returns one of the following
integer values:

  • 1

    Success. The Java VM had already been loaded and was attached
    to the current process.

  • 0

    Success. The Java VM was loaded and initialized and attached
    to the current process.

  • -1

    Failure. The Java VM was not loaded, possibly because jvm.dll was
    not found in the classpath.

  • -2

    Failure. The pbejbclient126.jar file
    was not found.

Examples

This example shows how createJavaVM might
be used with a connection to EAServer:

Usage

The isdebug argument is used to record
information about the Java VM, including class loads, in the file VM.out in
the directory where the current application is located.

The classpath argument must include the
classes and JAR files required by the server, if they are not already
listed in the classpath used by the Java VM.

note.png Classpath argument has no effect if the JVM is already
running

Files and directories passed only in the classpath argument
are not available to the Java VM if it has already been started
by another process. In the development environment, you can check
whether the Java VM is running and, if so, which classpath it is
using, on the Java page of the System Options dialog box. At runtime,
you can use the IsJavaVMLoaded method to determine whether
the Java VM is already running, and the GetJavaClasspath method to find the classpath.

In the development environment, the classpath used by the
Java VM is constructed by concatenating these paths:

  • A classpath added programmatically when the JVM is started.
    For example, the classpath you pass to this method.

  • The PowerBuilder runtime static registry classpath.
    This path is built into the pbjvm126.dll and
    contains classes required at runtime for features such as PDF generation
    and EJB clients.

  • The PowerBuilder system classpath. This path resides
    in a Windows registry key installed when you install PowerBuilder.
    It contains classes required at design time for Java-related PowerBuilder
    features.

  • The PowerBuilder user classpath. This is the path
    that you specify on the Java page of the System Options dialog box.

  • The system CLASSPATH environment variable.

  • The current directory.

The JVM uses the following classpath at runtime:

  • A classpath added programmatically when the JVM is started

  • The PowerBuilder runtime static registry classpath

  • The system CLASSPATH environment variable

  • The current directory

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x